On Thu, Apr 24, 2025, at 14:23, Radim Krčmář wrote: > 2025-04-23T17:45:53-07:00, Deepak Gupta <debug@xxxxxxxxxxxx>: >> On Thu, Apr 10, 2025 at 12:03:44PM +0200, Radim Krčmář wrote: >>>2025-03-14T14:39:25-07:00, Deepak Gupta <debug@xxxxxxxxxxxx>: >>>Why isn't the previous hunk be enough? (Or why don't we do just this?) >>> >>>riscv_sys_mmap() eventually calls arch_calc_vm_prot_bits(), so I'd >>>rather fix each code path just once. >> >> You're right. Above hunk (arch/riscv/include/asm/mman.h) alone should be enough. >> I did this change in `sys_riscv.c` out of caution. If it feels like un-necessary, >> I'll remove it. No hard feelings either way. > > I think it makes the code harder to reason about. Here it is not clear > why this caller of ksys_mmap_pgoff() has to do this, while others don't. Right, I've been meaning to clean this up for years: there should really not be anything architecture specific in the sys_mmap() or sys_mmap2() syscalls, but we never managed to have a global definition for those and instead leave them up to the architectures and over the years they have diverged. See below for my earlier prototype of this. Arnd