Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19395
b: refs/heads/master
c: db4c964
h: refs/heads/master
i:
  19393: ea135a8
  19391: ee56e90
v: v3
  • Loading branch information
Stephen Smalley authored and Linus Torvalds committed Feb 1, 2006
1 parent 47e3abc commit 5f5f268
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 30 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: ee13d785eac1fbe7e79ecca77bf7e902734a0b30
refs/heads/master: db4c9641def55d36a6f9df79deb8a949292313ca
50 changes: 21 additions & 29 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2454,35 +2454,27 @@ static int selinux_file_mprotect(struct vm_area_struct *vma,
prot = reqprot;

#ifndef CONFIG_PPC32
if ((prot & PROT_EXEC) && !(vma->vm_flags & VM_EXECUTABLE) &&
(vma->vm_start >= vma->vm_mm->start_brk &&
vma->vm_end <= vma->vm_mm->brk)) {
/*
* We are making an executable mapping in the brk region.
* This has an additional execheap check.
*/
rc = task_has_perm(current, current, PROCESS__EXECHEAP);
if (rc)
return rc;
}
if (vma->vm_file != NULL && vma->anon_vma != NULL && (prot & PROT_EXEC)) {
/*
* We are making executable a file mapping that has
* had some COW done. Since pages might have been written,
* check ability to execute the possibly modified content.
* This typically should only occur for text relocations.
*/
int rc = file_has_perm(current, vma->vm_file, FILE__EXECMOD);
if (rc)
return rc;
}
if (!vma->vm_file && (prot & PROT_EXEC) &&
vma->vm_start <= vma->vm_mm->start_stack &&
vma->vm_end >= vma->vm_mm->start_stack) {
/* Attempt to make the process stack executable.
* This has an additional execstack check.
*/
rc = task_has_perm(current, current, PROCESS__EXECSTACK);
if ((prot & PROT_EXEC) && !(vma->vm_flags & VM_EXEC)) {
rc = 0;
if (vma->vm_start >= vma->vm_mm->start_brk &&
vma->vm_end <= vma->vm_mm->brk) {
rc = task_has_perm(current, current,
PROCESS__EXECHEAP);
} else if (!vma->vm_file &&
vma->vm_start <= vma->vm_mm->start_stack &&
vma->vm_end >= vma->vm_mm->start_stack) {
rc = task_has_perm(current, current, PROCESS__EXECSTACK);
} else if (vma->vm_file && vma->anon_vma) {
/*
* We are making executable a file mapping that has
* had some COW done. Since pages might have been
* written, check ability to execute the possibly
* modified content. This typically should only
* occur for text relocations.
*/
rc = file_has_perm(current, vma->vm_file,
FILE__EXECMOD);
}
if (rc)
return rc;
}
Expand Down

0 comments on commit 5f5f268

Please sign in to comment.