This prevents cross-region mappings on IA64 and SPARC which could lead to system crash. They were correctly trapped for normal mmap() calls, but not for the kernel internal calls generated by executable loading. This code just moves the architecture-specific cross-region checks into an arch-specific "arch_mmap_check()" macro, and defines that for the architectures that needed it (ia64, sparc and sparc64). Architectures that don't have any special requirements can just ignore the new cross-region check, since the mmap() code will just notice on its own when the macro isn't defined. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Kirill Korotaev <dev@openvz.org> Acked-by: David Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> [ Cleaned up to not affect architectures that don't need it ] Signed-off-by: Linus Torvalds <torvalds@osdl.org>
		
			
				
	
	
		
			34 lines
		
	
	
		
			999 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			999 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef _ASM_IA64_MMAN_H
 | |
| #define _ASM_IA64_MMAN_H
 | |
| 
 | |
| /*
 | |
|  * Based on <asm-i386/mman.h>.
 | |
|  *
 | |
|  * Modified 1998-2000, 2002
 | |
|  *	David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
 | |
|  */
 | |
| 
 | |
| #include <asm-generic/mman.h>
 | |
| 
 | |
| #define MAP_GROWSDOWN	0x00100		/* stack-like segment */
 | |
| #define MAP_GROWSUP	0x00200		/* register stack-like segment */
 | |
| #define MAP_DENYWRITE	0x00800		/* ETXTBSY */
 | |
| #define MAP_EXECUTABLE	0x01000		/* mark it as an executable */
 | |
| #define MAP_LOCKED	0x02000		/* pages are locked */
 | |
| #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 MCL_CURRENT	1		/* lock all current mappings */
 | |
| #define MCL_FUTURE	2		/* lock all future mappings */
 | |
| 
 | |
| #ifdef __KERNEL__
 | |
| #ifndef __ASSEMBLY__
 | |
| #define arch_mmap_check	ia64_mmap_check
 | |
| int ia64_mmap_check(unsigned long addr, unsigned long len,
 | |
| 		unsigned long flags);
 | |
| #endif
 | |
| #endif
 | |
| 
 | |
| #endif /* _ASM_IA64_MMAN_H */
 |