Skip to content

Commit ca3fde5

Browse files
thejhjrjohansen
authored andcommitted
apparmor: don't try to replace stale label in ptraceme check
begin_current_label_crit_section() must run in sleepable context because when label_is_stale() is true, aa_replace_current_label() runs, which uses prepare_creds(), which can sleep. Until now, the ptraceme access check (which runs with tasklist_lock held) violated this rule. Fixes: b2d09ae ("apparmor: move ptrace checks to using labels") Reported-by: Cyrill Gorcunov <gorcunov@gmail.com> Reported-by: kernel test robot <rong.a.chen@intel.com> Signed-off-by: Jann Horn <jannh@google.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 0fb871c commit ca3fde5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎security/apparmor/lsm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ static int apparmor_ptrace_traceme(struct task_struct *parent)
132132
struct aa_label *tracer, *tracee;
133133
int error;
134134

135-
tracee = begin_current_label_crit_section();
135+
tracee = __begin_current_label_crit_section();
136136
tracer = aa_get_task_label(parent);
137137
error = aa_may_ptrace(tracer, tracee, AA_PTRACE_TRACE);
138138
aa_put_label(tracer);
139-
end_current_label_crit_section(tracee);
139+
__end_current_label_crit_section(tracee);
140140

141141
return error;
142142
}

0 commit comments

Comments
 (0)