Skip to contentSkip to conversation

remap_file_pages protection support: safety net for lazy arches

PATCH In review [email protected] 1 participant 1 message Aug 12, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 17/39 remap_file_pages protection support: safety net for lazy arches

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

Since proper support requires that the arch at the very least handles VM_FAULT_SIGSEGV, as in next patch (otherwise the arch may BUG), and things are even more complex (see next patches), and it's triggerable only with VM_NONUNIFORM vma's, simply refuse creating them if the arch doesn't declare itself ready.

This is a very temporary hack, so I've clearly marked it as such. And, with current rythms, I've given about 6 months for arches to get ready. Reducing this time is perfectly ok for me.

---

 linux-2.6.git-paolo/Documentation/feature-removal-schedule.txt |   12 ++++++++++
 linux-2.6.git-paolo/include/asm-i386/pgtable.h                 |    3 ++
 linux-2.6.git-paolo/include/asm-um/pgtable.h                   |    3 ++
 linux-2.6.git-paolo/mm/fremap.c                                |    5 ++++
 4 files changed, 23 insertions(+)
mm/fremap.c renamed from mm/fremap.c~rfp-safety-net-for-archs +5 -0
diff -puN mm/fremap.c~rfp-safety-net-for-archs mm/fremap.c
@@ -184,6 +184,11 @@ asmlinkage long sys_remap_file_pages(uns
 	int err = -EINVAL;
 	int has_write_lock = 0;
 
+	/* Hack for not-updated archs, KILLME after 2.6.16! */
+#ifndef __ARCH_SUPPORTS_VM_NONUNIFORM
+	if (flags & MAP_NOINHERIT)
+		goto out;
+#endif
 	if (prot && !(flags & MAP_NOINHERIT))
 		goto out;
 	/*
include/asm-i386/pgtable.h renamed from include/asm-i386/pgtable.h~rfp-safety-net-for-archs +3 -0
diff -puN include/asm-i386/pgtable.h~rfp-safety-net-for-archs include/asm-i386/pgtable.h
@@ -419,4 +419,7 @@ extern void noexec_setup(const char *str
 #define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>
 
+/* Hack for not-updated archs, KILLME after 2.6.16! */
+#define __ARCH_SUPPORTS_VM_NONUNIFORM
+
 #endif /* _I386_PGTABLE_H */
include/asm-um/pgtable.h renamed from include/asm-um/pgtable.h~rfp-safety-net-for-archs +3 -0
diff -puN include/asm-um/pgtable.h~rfp-safety-net-for-archs include/asm-um/pgtable.h
@@ -361,6 +361,9 @@ static inline pte_t pte_modify(pte_t pte
 
 #include <asm-generic/pgtable-nopud.h>
 
+/* Hack for not-updated archs, KILLME after 2.6.16! */
+#define __ARCH_SUPPORTS_VM_NONUNIFORM
+
 #endif
 #endif
 
Documentation/feature-removal-schedule.txt renamed from Documentation/feature-removal-schedule.txt~rfp-safety-net-for-archs +12 -0
diff -puN Documentation/feature-removal-schedule.txt~rfp-safety-net-for-archs Documentation/feature-removal-schedule.txt
@@ -135,3 +135,15 @@ Why:	With the 16-bit PCMCIA subsystem no
 	pcmciautils package available at
 	http://kernel.org/pub/linux/utils/kernel/pcmcia/
 Who:	Dominik Brodowski <[email protected]>
+
+---------------------------
+
+What:	__ARCH_SUPPORTS_VM_NONUNIFORM
+When:	December 2005
+Files:	mm/fremap.c, include/asm-*/pgtable.h
+Why:	It's just there to allow arches to update their page fault handlers to
+	support VM_FAULT_SIGSEGV, for remap_file_pages protection support.
+	Since they may BUG if this support is not added, the syscall code
+	refuses this new operation mode unless the arch declares itself as
+	"VM_FAULT_SIGSEGV-aware" with this macro.
+Who:	Paolo 'Blaisorblade' Giarrusso <[email protected]>

_