exec: Remove LSM_UNSAFE_PTRACE_CAP
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 23 Jan 2017 04:26:31 +0000 (17:26 +1300)
committerEric W. Biederman <ebiederm@xmission.com>
Mon, 23 Jan 2017 23:03:08 +0000 (12:03 +1300)
With previous changes every location that tests for
LSM_UNSAFE_PTRACE_CAP also tests for LSM_UNSAFE_PTRACE making the
LSM_UNSAFE_PTRACE_CAP redundant, so remove it.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/exec.c
include/linux/security.h
security/apparmor/domain.c
security/commoncap.c
security/selinux/hooks.c
security/smack/smack_lsm.c

index e579466107335bf4b704863469a4162c8c335adb..c195ebb8e2aaa961d718fb2c800c3e029e0c0bbd 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1426,12 +1426,8 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
        struct task_struct *p = current, *t;
        unsigned n_fs;
 
-       if (p->ptrace) {
-               if (ptracer_capable(p, current_user_ns()))
-                       bprm->unsafe |= LSM_UNSAFE_PTRACE_CAP;
-               else
-                       bprm->unsafe |= LSM_UNSAFE_PTRACE;
-       }
+       if (p->ptrace)
+               bprm->unsafe |= LSM_UNSAFE_PTRACE;
 
        /*
         * This isn't strictly necessary, but it makes it harder for LSMs to
index c2125e9093e8e51b51662ba8ce4a5faa767710b6..9d9ee90f1f3574262e2c778a1d904b25f58a5227 100644 (file)
@@ -140,8 +140,7 @@ struct request_sock;
 /* bprm->unsafe reasons */
 #define LSM_UNSAFE_SHARE       1
 #define LSM_UNSAFE_PTRACE      2
-#define LSM_UNSAFE_PTRACE_CAP  4
-#define LSM_UNSAFE_NO_NEW_PRIVS        8
+#define LSM_UNSAFE_NO_NEW_PRIVS        4
 
 #ifdef CONFIG_MMU
 extern int mmap_min_addr_handler(struct ctl_table *table, int write,
index a4d90aa1045afc46499e00da9baf9bbcea34752a..04185b7fd38aea05b050cef1f4e79ea7303117a2 100644 (file)
@@ -469,7 +469,7 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
                ;
        }
 
-       if (bprm->unsafe & (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
+       if (bprm->unsafe & LSM_UNSAFE_PTRACE) {
                error = may_change_ptraced_domain(new_profile);
                if (error)
                        goto audit;
index cbb203c914062449fdef4862a2c2b34f13701d9b..8ec6b7fe909e089700134f87f6df1e6824dd763f 100644 (file)
@@ -548,7 +548,7 @@ skip:
 
        if ((is_setid ||
             !cap_issubset(new->cap_permitted, old->cap_permitted)) &&
-           ((bprm->unsafe & ~(LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) ||
+           ((bprm->unsafe & ~LSM_UNSAFE_PTRACE) ||
             !ptracer_capable(current, new->user_ns))) {
                /* downgrade; they get no more than they had, and maybe less */
                if (!ns_capable(new->user_ns, CAP_SETUID) ||
index c7c6619431d5fb4922dd729e9e49dd910d7967d2..cece6fe55f02ed8f35efd86c11f399f95c2689d2 100644 (file)
@@ -2404,8 +2404,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
 
                /* Make sure that anyone attempting to ptrace over a task that
                 * changes its SID has the appropriate permit */
-               if (bprm->unsafe &
-                   (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
+               if (bprm->unsafe & LSM_UNSAFE_PTRACE) {
                        u32 ptsid = ptrace_parent_sid(current);
                        if (ptsid != 0) {
                                rc = avc_has_perm(ptsid, new_tsec->sid,
index 94dc9d406ce33060513231c1f93727a51a106e14..bc2ff09f1494ece4f34f0971c842540436364ebb 100644 (file)
@@ -934,7 +934,7 @@ static int smack_bprm_set_creds(struct linux_binprm *bprm)
            isp->smk_task != sbsp->smk_root)
                return 0;
 
-       if (bprm->unsafe & (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
+       if (bprm->unsafe & LSM_UNSAFE_PTRACE) {
                struct task_struct *tracer;
                rc = 0;