From: David Hildenbrand Date: Fri, 23 Apr 2021 07:38:14 +0000 (+0200) Subject: mm: ignore MAP_DENYWRITE in ksys_mmap_pgoff() X-Git-Tag: accepted/tizen/unified/20230118.172025~6463^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6128b3af2a5e42386aa7faf37609b57f39fb7d00;p=platform%2Fkernel%2Flinux-rpi.git mm: ignore MAP_DENYWRITE in ksys_mmap_pgoff() Let's also remove masking off MAP_DENYWRITE from ksys_mmap_pgoff(): the last in-tree occurrence of MAP_DENYWRITE is now in LEGACY_MAP_MASK, which accepts the flag e.g., for MAP_SHARED_VALIDATE; however, the flag is ignored throughout the kernel now. Add a comment to LEGACY_MAP_MASK stating that MAP_DENYWRITE is ignored. Acked-by: "Eric W. Biederman" Acked-by: Christian König Signed-off-by: David Hildenbrand --- diff --git a/include/linux/mman.h b/include/linux/mman.h index bd9aadd..b66e91b 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h @@ -32,7 +32,8 @@ * The historical set of flags that all mmap implementations implicitly * support when a ->mmap_validate() op is not provided in file_operations. * - * MAP_EXECUTABLE is completely ignored throughout the kernel. + * MAP_EXECUTABLE and MAP_DENYWRITE are completely ignored throughout the + * kernel. */ #define LEGACY_MAP_MASK (MAP_SHARED \ | MAP_PRIVATE \ diff --git a/mm/mmap.c b/mm/mmap.c index 589dc1d..bf11fc6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1626,8 +1626,6 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len, return PTR_ERR(file); } - flags &= ~MAP_DENYWRITE; - retval = vm_mmap_pgoff(file, addr, len, prot, flags, pgoff); out_fput: if (file) diff --git a/mm/nommu.c b/mm/nommu.c index 3a93d40..0987d13 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1296,8 +1296,6 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len, goto out; } - flags &= ~MAP_DENYWRITE; - retval = vm_mmap_pgoff(file, addr, len, prot, flags, pgoff); if (file)