Skip to content

Commit

Permalink
sysctl: require CAP_SYS_RAWIO to set mmap_min_addr
Browse files Browse the repository at this point in the history
Currently the mmap_min_addr value can only be bypassed during mmap when
the task has CAP_SYS_RAWIO.  However, the mmap_min_addr sysctl value itself
can be adjusted to 0 if euid == 0, allowing a bypass without CAP_SYS_RAWIO.
This patch adds a check for the capability before allowing mmap_min_addr to
be changed.

Signed-off-by: Kees Cook <[email protected]>
Acked-by: Serge Hallyn <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
Kees Cook authored and James Morris committed Nov 8, 2009
1 parent 31bde71 commit 0e1a6ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions security/min_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ int mmap_min_addr_handler(struct ctl_table *table, int write,
{
int ret;

if (!capable(CAP_SYS_RAWIO))
return -EPERM;

ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);

update_mmap_min_addr();
Expand Down

0 comments on commit 0e1a6ef

Please sign in to comment.