Skip to contentSkip to conversation

remap_file_pages protection support: add MAP_NOINHERIT flag

PATCH In review [email protected] 2 participants 3 messages Aug 12, 2005 – Aug 22, 2005 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 11/39 remap_file_pages protection support: add MAP_NOINHERIT flag

From: Paolo 'Blaisorblade' Giarrusso <[email protected]>

Add the MAP_NOINHERIT flag to arch headers, for use with remap-file-pages.

---

 linux-2.6.git-paolo/include/asm-i386/mman.h   |    1 +
 linux-2.6.git-paolo/include/asm-ia64/mman.h   |    1 +
 linux-2.6.git-paolo/include/asm-ppc/mman.h    |    1 +
 linux-2.6.git-paolo/include/asm-ppc64/mman.h  |    1 +
 linux-2.6.git-paolo/include/asm-s390/mman.h   |    1 +
 linux-2.6.git-paolo/include/asm-x86_64/mman.h |    1 +
 6 files changed, 6 insertions(+)
include/asm-i386/mman.h renamed from include/asm-i386/mman.h~rfp-map-noinherit +1 -0
diff -puN include/asm-i386/mman.h~rfp-map-noinherit include/asm-i386/mman.h
@@ -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_NOINHERIT	0x20000		/* don't inherit the protection bits of the underlying vma*/
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
include/asm-ia64/mman.h renamed from include/asm-ia64/mman.h~rfp-map-noinherit +1 -0
diff -puN include/asm-ia64/mman.h~rfp-map-noinherit include/asm-ia64/mman.h
@@ -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_NOINHERIT	0x20000		/* don't inherit the protection bits of the underlying vma*/
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
include/asm-ppc64/mman.h renamed from include/asm-ppc64/mman.h~rfp-map-noinherit +1 -0
diff -puN include/asm-ppc64/mman.h~rfp-map-noinherit include/asm-ppc64/mman.h
@@ -38,6 +38,7 @@
 
 #define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
 #define MAP_NONBLOCK	0x10000		/* do not block on IO */
+#define MAP_NOINHERIT	0x20000		/* don't inherit the protection bits of the underlying vma*/
 
 #define MADV_NORMAL	0x0		/* default page-in behavior */
 #define MADV_RANDOM	0x1		/* page-in minimum required */
include/asm-ppc/mman.h renamed from include/asm-ppc/mman.h~rfp-map-noinherit +1 -0
diff -puN include/asm-ppc/mman.h~rfp-map-noinherit include/asm-ppc/mman.h
@@ -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_NOINHERIT	0x20000		/* don't inherit the protection bits of the underlying vma*/
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
include/asm-s390/mman.h renamed from include/asm-s390/mman.h~rfp-map-noinherit +1 -0
diff -puN include/asm-s390/mman.h~rfp-map-noinherit include/asm-s390/mman.h
@@ -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_NOINHERIT	0x20000		/* don't inherit the protection bits of the underlying vma*/
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
include/asm-x86_64/mman.h renamed from include/asm-x86_64/mman.h~rfp-map-noinherit +1 -0
diff -puN include/asm-x86_64/mman.h~rfp-map-noinherit include/asm-x86_64/mman.h
@@ -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_NOINHERIT	0x20000		/* don't inherit the protection bits of the underlying vma*/
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */

_

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 3 lines · On Fri, Aug 12, 2005 at 08:21:23PM +0200, [email protected] wrote:

From: Paolo 'Blaisorblade' Giarrusso <[email protected]>

Add the MAP_NOINHERIT flag to arch headers, for use with remap-file-pages.

Does this mean ARM will break when these patches are merged?

Quoted 10 lines

---

 linux-2.6.git-paolo/include/asm-i386/mman.h   |    1 +
 linux-2.6.git-paolo/include/asm-ia64/mman.h   |    1 +
 linux-2.6.git-paolo/include/asm-ppc/mman.h    |    1 +
 linux-2.6.git-paolo/include/asm-ppc64/mman.h  |    1 +
 linux-2.6.git-paolo/include/asm-s390/mman.h   |    1 +
 linux-2.6.git-paolo/include/asm-x86_64/mman.h |    1 +
 6 files changed, 6 insertions(+)
Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#2 lore raw
Quoted 7 lines · Russell King
Quoted 4 lines · On Fri, Aug 12, 2005 at 08:21:23PM +0200, [email protected] wrote:

From: Paolo 'Blaisorblade' Giarrusso <[email protected]>

Add the MAP_NOINHERIT flag to arch headers, for use with remap-file-pages.

Does this mean ARM will break when these patches are merged?

Sorry for missing answer, I was disconnected.

Well, when they'll be merged in -mm you(and other archs) will see a bit of things screwing up, but *this* patch is trivial to port to all archs.

The real problem will be updating the PTE encoding macros (see pte_file and sys_remap_file_pages) to also store the page protections. Or at least pretend they do - things won't compile otherwise.

However, those patches stayed around in -mm for a while, since 2.6.4-rc2-mm1 to 2.6.5-mm1, so the (basic) fixes will be of the same kind.

VM_FAULT_SIGSEGV is much more though, however. When VMA pages can change protection, permission checking must move to the generic VM. See patches for i386 about that (patches for other architectures are compile-only, and don't handle properly this aspect).

However, don't worry for now, we'll be discussing this on next try. Mass arch updating will happen after the patch has been set into its definitive shape.

Signature · 23 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel