Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157320
b: refs/heads/master
c: 84336d1
h: refs/heads/master
v: v3
  • Loading branch information
Eric Paris authored and James Morris committed Aug 5, 2009
1 parent 7b7eb2b commit 68edc86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7c73875e7dda627040b12c19b01db634fa7f0fd1
refs/heads/master: 84336d1a77ccd2c06a730ddd38e695c2324a7386
14 changes: 13 additions & 1 deletion trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3034,9 +3034,21 @@ static int selinux_file_mmap(struct file *file, unsigned long reqprot,
int rc = 0;
u32 sid = current_sid();

if (addr < mmap_min_addr)
/*
* notice that we are intentionally putting the SELinux check before
* the secondary cap_file_mmap check. This is such a likely attempt
* at bad behaviour/exploit that we always want to get the AVC, even
* if DAC would have also denied the operation.
*/
if (addr < mmap_min_addr) {
rc = avc_has_perm(sid, sid, SECCLASS_MEMPROTECT,
MEMPROTECT__MMAP_ZERO, NULL);
if (rc)
return rc;
}

/* do DAC check on address space usage */
rc = cap_file_mmap(file, reqprot, prot, flags, addr, addr_only);
if (rc || addr_only)
return rc;

Expand Down

0 comments on commit 68edc86

Please sign in to comment.