]> git.baikalelectronics.ru Git - 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)
committerJohn Johansen <john.johansen@canonical.com>
Thu, 13 Sep 2018 16:44:56 +0000 (09:44 -0700)
commiteee5043648ad4c46ecc647b7170cb6ca5b12da46
tree22ec503efa895edcbc8a0bdd465d4206cad19311
parent9bb4cdee08f5bb5616aee5b42f9b659f3af351d3
apparmor: don't try to replace stale label in ptrace access check

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: 61351207cb784 ("apparmor: move ptrace checks to using labels")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/include/cred.h
security/apparmor/lsm.c