File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1426,12 +1426,8 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
14261426 struct task_struct * p = current , * t ;
14271427 unsigned n_fs ;
14281428
1429- if (p -> ptrace ) {
1430- if (ptracer_capable (p , current_user_ns ()))
1431- bprm -> unsafe |= LSM_UNSAFE_PTRACE_CAP ;
1432- else
1433- bprm -> unsafe |= LSM_UNSAFE_PTRACE ;
1434- }
1429+ if (p -> ptrace )
1430+ bprm -> unsafe |= LSM_UNSAFE_PTRACE ;
14351431
14361432 /*
14371433 * This isn't strictly necessary, but it makes it harder for LSMs to
Original file line number Diff line number Diff line change @@ -140,8 +140,7 @@ struct request_sock;
140140/* bprm->unsafe reasons */
141141#define LSM_UNSAFE_SHARE 1
142142#define LSM_UNSAFE_PTRACE 2
143- #define LSM_UNSAFE_PTRACE_CAP 4
144- #define LSM_UNSAFE_NO_NEW_PRIVS 8
143+ #define LSM_UNSAFE_NO_NEW_PRIVS 4
145144
146145#ifdef CONFIG_MMU
147146extern int mmap_min_addr_handler (struct ctl_table * table , int write ,
Original file line number Diff line number Diff line change @@ -469,7 +469,7 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
469469 ;
470470 }
471471
472- if (bprm -> unsafe & ( LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP ) ) {
472+ if (bprm -> unsafe & LSM_UNSAFE_PTRACE ) {
473473 error = may_change_ptraced_domain (new_profile );
474474 if (error )
475475 goto audit ;
Original file line number Diff line number Diff line change @@ -548,7 +548,7 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
548548
549549 if ((is_setid ||
550550 !cap_issubset (new -> cap_permitted , old -> cap_permitted )) &&
551- ((bprm -> unsafe & ~( LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP ) ) ||
551+ ((bprm -> unsafe & ~LSM_UNSAFE_PTRACE ) ||
552552 !ptracer_capable (current , new -> user_ns ))) {
553553 /* downgrade; they get no more than they had, and maybe less */
554554 if (!ns_capable (new -> user_ns , CAP_SETUID ) ||
Original file line number Diff line number Diff line change @@ -2404,8 +2404,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
24042404
24052405 /* Make sure that anyone attempting to ptrace over a task that
24062406 * changes its SID has the appropriate permit */
2407- if (bprm -> unsafe &
2408- (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP )) {
2407+ if (bprm -> unsafe & LSM_UNSAFE_PTRACE ) {
24092408 u32 ptsid = ptrace_parent_sid (current );
24102409 if (ptsid != 0 ) {
24112410 rc = avc_has_perm (ptsid , new_tsec -> sid ,
Original file line number Diff line number Diff line change @@ -934,7 +934,7 @@ static int smack_bprm_set_creds(struct linux_binprm *bprm)
934934 isp -> smk_task != sbsp -> smk_root )
935935 return 0 ;
936936
937- if (bprm -> unsafe & ( LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP ) ) {
937+ if (bprm -> unsafe & LSM_UNSAFE_PTRACE ) {
938938 struct task_struct * tracer ;
939939 rc = 0 ;
940940
You can’t perform that action at this time.
0 commit comments