提交 075292c4 编写于 作者: J Jann Horn 提交者: Yang Yingliang

apparmor: don't try to replace stale label in ptraceme check

[ Upstream commit ca3fde52 ]

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: b2d09ae4 ("apparmor: move ptrace checks to using labels")
Reported-by: NCyrill Gorcunov <gorcunov@gmail.com>
Reported-by: Nkernel test robot <rong.a.chen@intel.com>
Signed-off-by: NJann Horn <jannh@google.com>
Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 643b9764
...@@ -130,11 +130,11 @@ static int apparmor_ptrace_traceme(struct task_struct *parent) ...@@ -130,11 +130,11 @@ static int apparmor_ptrace_traceme(struct task_struct *parent)
struct aa_label *tracer, *tracee; struct aa_label *tracer, *tracee;
int error; int error;
tracee = begin_current_label_crit_section(); tracee = __begin_current_label_crit_section();
tracer = aa_get_task_label(parent); tracer = aa_get_task_label(parent);
error = aa_may_ptrace(tracer, tracee, AA_PTRACE_TRACE); error = aa_may_ptrace(tracer, tracee, AA_PTRACE_TRACE);
aa_put_label(tracer); aa_put_label(tracer);
end_current_label_crit_section(tracee); __end_current_label_crit_section(tracee);
return error; return error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册