diff options
author | Christoph Lameter <cl@linux-foundation.org> | 2009-06-03 16:04:31 -0400 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2009-08-13 15:06:08 -0700 |
commit | 05f6ab599ef820e96070cc66c00953d8506d1026 (patch) | |
tree | 7574471205dea1c3bf237f3cb4fc66e709fda49a /include | |
parent | c8853459b739e5f43da0badc1605a0a0c0c8195d (diff) |
security: use mmap_min_addr indepedently of security models
This patch removes the dependency of mmap_min_addr on CONFIG_SECURITY.
It also sets a default mmap_min_addr of 4096.
mmapping of addresses below 4096 will only be possible for processes
with CAP_SYS_RAWIO.
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Acked-by: Eric Paris <eparis@redhat.com>
Looks-ok-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mm.h | 2 | ||||
-rw-r--r-- | include/linux/security.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 32c85d517fc9..97c057a3bffd 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -578,12 +578,10 @@ static inline void set_page_links(struct page *page, enum zone_type zone, */ static inline unsigned long round_hint_to_min(unsigned long hint) { -#ifdef CONFIG_SECURITY hint &= PAGE_MASK; if (((void *)hint != NULL) && (hint < mmap_min_addr)) return PAGE_ALIGN(mmap_min_addr); -#endif return hint; } diff --git a/include/linux/security.h b/include/linux/security.h index 1f2ab6353c00..87e9b8b13f16 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -2203,6 +2203,8 @@ static inline int security_file_mmap(struct file *file, unsigned long reqprot, unsigned long addr, unsigned long addr_only) { + if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO)) + return -EACCES; return 0; } |