Skip to content

Commit

Permalink
Security: allow capable check to permit mmap or low vm space
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
eparis authored and James Morris committed Dec 5, 2007
1 parent d313f94 commit ab5a91a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static int dummy_file_mmap (struct file *file, unsigned long reqprot,
unsigned long addr,
unsigned long addr_only)
{
if (addr < mmap_min_addr)
if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO))
return -EACCES;
return 0;
}
Expand Down

0 comments on commit ab5a91a

Please sign in to comment.