introduce a mmap MAP_DONTEXPAND flag
A message that is not in the archive (sent off-list or not yet received): [email protected]
asm-i386/mman.h line 25
Quoted 8 lines · Bart Oldeman
(quoted diff) +0
-0return -EPERM;asm-i386/mman.h renamed from asm-i386/mman.h~ +1
-0@@ -22,6 +22,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */
*always* when you change something in asm-i386 check if other architectures need changing too. Your patch would break compilation for everybody !i386
-Andi
Quoted 13 lines · Andi Kleen
asm-i386/mman.h line 25
Quoted 8 lines · Bart Oldeman
(quoted diff) +0
-0return -EPERM;asm-i386/mman.h renamed from asm-i386/mman.h~ +1
-0@@ -22,6 +22,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ *always* when you change something in asm-i386 check if other architectures need changing too. Your patch would break compilation for everybody !i386
that's the reason for my i386 comment and the "RFC". Just asking if people do or do not like the idea. Anyway, I've done the whole bunch now.
mmap.c renamed from mmap.c~ +4 -0
@@ -511,6 +511,10 @@ vm_flags =calc_vm_prot_bits (prot) |calc_vm_flag_bits (flags) | mm->def_flags |VM_MAYREAD |VM_MAYWRITE |VM_MAYEXEC ; +if (flags &MAP_DONTEXPAND ) { + vm_flags |=VM_DONTEXPAND ; + } +if (flags &MAP_LOCKED ) {if (!capable (CAP_IPC_LOCK ))return -EPERM ;
asm-alpha/mman.h +1 -0
@@ -28,6 +28,7 @@#define MAP_NORESERVE 0x10000/* don't check for reservations */ #define MAP_POPULATE 0x20000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x40000/* do not block on IO */ +#define MAP_DONTEXPAND 0x80000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_SYNC 2/* synchronous memory sync */
asm-arm/mman.h +1 -0
@@ -22,6 +22,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) page tables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-arm26/mman.h +1 -0
@@ -22,6 +22,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) page tables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-cris/mman.h +1 -0
@@ -24,6 +24,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-h8300/mman.h +1 -0
@@ -19,6 +19,7 @@#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ #define MAP_LOCKED 0x2000/* pages are locked */ #define MAP_NORESERVE 0x4000/* don't check for reservations */ +#define MAP_DONTEXPAND 0x8000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-i386/mman.h +1 -0
@@ -22,6 +22,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-ia64/mman.h +1 -0
@@ -30,6 +30,7 @@#define MAP_NORESERVE 0x04000/* don't check for reservations */ #define MAP_POPULATE 0x08000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-m68k/mman.h +1 -0
@@ -22,6 +22,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-ppc/mman.h +1 -0
@@ -23,6 +23,7 @@#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-ppc64/mman.h +1 -0
@@ -28,6 +28,7 @@#define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */ #define MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define MAP_DONTEXPAND 0x2000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-s390/mman.h +1 -0
@@ -30,6 +30,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-sh/mman.h +1 -0
@@ -22,6 +22,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) page tables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-sparc/mman.h +1 -0
@@ -26,6 +26,7 @@#define MAP_GROWSDOWN 0x0200/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */ #define MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define MAP_DONTEXPAND 0x2000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-sparc64/mman.h +1 -0
@@ -26,6 +26,7 @@#define MAP_GROWSDOWN 0x0200/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */ #define MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define MAP_DONTEXPAND 0x2000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-v850/mman.h +1 -0
@@ -19,6 +19,7 @@#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ #define MAP_LOCKED 0x2000/* pages are locked */ #define MAP_NORESERVE 0x4000/* don't check for reservations */ +#define MAP_DONTEXPAND 0x8000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */
asm-x86_64/mman.h +1 -0
@@ -23,6 +23,7 @@#define MAP_NORESERVE 0x4000/* don't check for reservations */ #define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_DONTEXPAND 0x20000/* do not allow mremap to expand */ #define MS_ASYNC 1/* sync memory asynchronously */ #define MS_INVALIDATE 2/* invalidate the caches */