Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156842
b: refs/heads/master
c: 8cf948e
h: refs/heads/master
v: v3
  • Loading branch information
Eric Paris authored and James Morris committed Aug 17, 2009
1 parent 6e432e7 commit 00a2881
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: 9c0d90103c7e0eb6e638e5b649e9f6d8d9c1b4b3
refs/heads/master: 8cf948e744e0218af604c32edecde10006dc8e9e
14 changes: 13 additions & 1 deletion trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3030,9 +3030,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 00a2881

Please sign in to comment.