diff options
author | Eric Paris <eparis@redhat.com> | 2007-11-26 18:47:46 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2007-12-05 08:24:30 -0500 |
commit | ab5a91a8364c3d6fc617abc47cc81d162c01d90a (patch) | |
tree | 0b7f4ef877f56be57f75b8b455b9f694f19da633 /security/dummy.c | |
parent | d313f948309ab22797316e789a7ff8fa358176b6 (diff) |
Security: allow capable check to permit mmap or low vm space
On a kernel with CONFIG_SECURITY but without an LSM which implements
security_file_mmap it is impossible for an application to mmap addresses
lower than mmap_min_addr. Based on a suggestion from a developer in the
openwall community this patch adds a check for CAP_SYS_RAWIO. It is
assumed that any process with this capability can harm the system a lot
more easily than writing some stuff on the zero page and then trying to
get the kernel to trip over itself. It also means that programs like X
on i686 which use vm86 emulation can work even with mmap_min_addr set.
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/dummy.c')
-rw-r--r-- | security/dummy.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/dummy.c b/security/dummy.c index 6d895ade73de..3ccfbbe973b6 100644 --- a/security/dummy.c +++ b/security/dummy.c | |||
@@ -426,7 +426,7 @@ static int dummy_file_mmap (struct file *file, unsigned long reqprot, | |||
426 | unsigned long addr, | 426 | unsigned long addr, |
427 | unsigned long addr_only) | 427 | unsigned long addr_only) |
428 | { | 428 | { |
429 | if (addr < mmap_min_addr) | 429 | if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO)) |
430 | return -EACCES; | 430 | return -EACCES; |
431 | return 0; | 431 | return 0; |
432 | } | 432 | } |