diff options
author | Jann Horn <jannh@google.com> | 2018-09-29 03:49:26 +0200 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2020-06-30 23:17:03 -0400 |
commit | 3f9a54ce49147268c6f5be1c00fb08e9a08f01cc (patch) | |
tree | ebd58dac103207b612be338560c0d2174d31b496 /security | |
parent | 0255fb2f1a1248a81b7e65df4039a9b01b9345e9 (diff) | |
download | linux-stable-3f9a54ce49147268c6f5be1c00fb08e9a08f01cc.tar.gz linux-stable-3f9a54ce49147268c6f5be1c00fb08e9a08f01cc.tar.bz2 linux-stable-3f9a54ce49147268c6f5be1c00fb08e9a08f01cc.zip |
apparmor: don't try to replace stale label in ptraceme check
[ Upstream commit ca3fde5214e1d24f78269b337d3f22afd6bf445e ]
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: b2d09ae449ced ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/lsm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 5e32fe434140..898752b818dc 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -130,11 +130,11 @@ static int apparmor_ptrace_traceme(struct task_struct *parent) struct aa_label *tracer, *tracee; int error; - tracee = begin_current_label_crit_section(); + tracee = __begin_current_label_crit_section(); tracer = aa_get_task_label(parent); error = aa_may_ptrace(tracer, tracee, AA_PTRACE_TRACE); aa_put_label(tracer); - end_current_label_crit_section(tracee); + __end_current_label_crit_section(tracee); return error; } |