]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
apparmor: don't try to replace stale label in ptrace access check
authorJann Horn <jannh@google.com>
Thu, 13 Sep 2018 16:12:09 +0000 (18:12 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commit5b9276f0312a8866928088fa05d170e551b5cd3e
tree36b9cbcf87547da224d6a2905581e4111d303702
parent3ec3c8d554f6ddfd95c0318ee4cc537c651c9f22
apparmor: don't try to replace stale label in ptrace access check

BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 1f8266ff58840d698a1e96d2274189de1bdf7969 ]

As a comment above begin_current_label_crit_section() explains,
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 ptrace access check (which runs with a task lock held)
violated this rule.

Also add a might_sleep() assertion to begin_current_label_crit_section(),
because asserts are less likely to be ignored than comments.

Fixes: b2d09ae449ced ("apparmor: move ptrace checks to using labels")
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
security/apparmor/include/context.h
security/apparmor/lsm.c