aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pretzel.yyz.us>2005-06-26 18:06:06 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-26 18:06:06 -0400
commitaef7b83c92dd0b7e994805440655d1d64147287b (patch)
tree981f373358c1988e061625e8f272013065cb086f /security/selinux/hooks.c
parentb1fc5505e0dbcc3fd7c75bfe6bee39ec50080963 (diff)
parent8678887e7fb43cd6c9be6c9807b05e77848e0920 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index aae1e794fe48..17a1189f1ff8 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1658,9 +1658,8 @@ static int selinux_bprm_secureexec (struct linux_binprm *bprm)
1658 1658
1659static void selinux_bprm_free_security(struct linux_binprm *bprm) 1659static void selinux_bprm_free_security(struct linux_binprm *bprm)
1660{ 1660{
1661 struct bprm_security_struct *bsec = bprm->security; 1661 kfree(bprm->security);
1662 bprm->security = NULL; 1662 bprm->security = NULL;
1663 kfree(bsec);
1664} 1663}
1665 1664
1666extern struct vfsmount *selinuxfs_mount; 1665extern struct vfsmount *selinuxfs_mount;
@@ -1945,6 +1944,7 @@ static int selinux_sb_copy_data(struct file_system_type *type, void *orig, void
1945 } while (*in_end++); 1944 } while (*in_end++);
1946 1945
1947 copy_page(in_save, nosec_save); 1946 copy_page(in_save, nosec_save);
1947 free_page((unsigned long)nosec_save);
1948out: 1948out:
1949 return rc; 1949 return rc;
1950} 1950}
@@ -2476,6 +2476,17 @@ static int selinux_file_mprotect(struct vm_area_struct *vma,
2476 prot = reqprot; 2476 prot = reqprot;
2477 2477
2478#ifndef CONFIG_PPC32 2478#ifndef CONFIG_PPC32
2479 if ((prot & PROT_EXEC) && !(vma->vm_flags & VM_EXECUTABLE) &&
2480 (vma->vm_start >= vma->vm_mm->start_brk &&
2481 vma->vm_end <= vma->vm_mm->brk)) {
2482 /*
2483 * We are making an executable mapping in the brk region.
2484 * This has an additional execheap check.
2485 */
2486 rc = task_has_perm(current, current, PROCESS__EXECHEAP);
2487 if (rc)
2488 return rc;
2489 }
2479 if (vma->vm_file != NULL && vma->anon_vma != NULL && (prot & PROT_EXEC)) { 2490 if (vma->vm_file != NULL && vma->anon_vma != NULL && (prot & PROT_EXEC)) {
2480 /* 2491 /*
2481 * We are making executable a file mapping that has 2492 * We are making executable a file mapping that has
@@ -2487,6 +2498,16 @@ static int selinux_file_mprotect(struct vm_area_struct *vma,
2487 if (rc) 2498 if (rc)
2488 return rc; 2499 return rc;
2489 } 2500 }
2501 if (!vma->vm_file && (prot & PROT_EXEC) &&
2502 vma->vm_start <= vma->vm_mm->start_stack &&
2503 vma->vm_end >= vma->vm_mm->start_stack) {
2504 /* Attempt to make the process stack executable.
2505 * This has an additional execstack check.
2506 */
2507 rc = task_has_perm(current, current, PROCESS__EXECSTACK);
2508 if (rc)
2509 return rc;
2510 }
2490#endif 2511#endif
2491 2512
2492 return file_map_prot_check(vma->vm_file, prot, vma->vm_flags&VM_SHARED); 2513 return file_map_prot_check(vma->vm_file, prot, vma->vm_flags&VM_SHARED);
@@ -3419,7 +3440,7 @@ static int selinux_nlmsg_perm(struct sock *sk, struct sk_buff *skb)
3419 err = selinux_nlmsg_lookup(isec->sclass, nlh->nlmsg_type, &perm); 3440 err = selinux_nlmsg_lookup(isec->sclass, nlh->nlmsg_type, &perm);
3420 if (err) { 3441 if (err) {
3421 if (err == -EINVAL) { 3442 if (err == -EINVAL) {
3422 audit_log(current->audit_context, 3443 audit_log(current->audit_context, AUDIT_SELINUX_ERR,
3423 "SELinux: unrecognized netlink message" 3444 "SELinux: unrecognized netlink message"
3424 " type=%hu for sclass=%hu\n", 3445 " type=%hu for sclass=%hu\n",
3425 nlh->nlmsg_type, isec->sclass); 3446 nlh->nlmsg_type, isec->sclass);