Commit 5b9276f0 authored by Jann Horn's avatar Jann Horn Committed by Khalid Elmously
Browse files

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

BugLink: https://bugs.launchpad.net/bugs/1863019



[ Upstream commit 1f8266ff ]

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: b2d09ae4 ("apparmor: move ptrace checks to using labels")
Signed-off-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 3ec3c8d5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment