linux-stable/security/apparmor
Jann Horn e58f543fc7 apparmor: don't try to replace stale label in ptrace access check
[ Upstream commit 1f8266ff58 ]

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: b2d09ae449 ("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>
2020-01-27 14:49:55 +01:00
..
include apparmor: don't try to replace stale label in ptrace access check 2020-01-27 14:49:55 +01:00
.gitignore apparmor: add base infastructure for socket mediation 2018-03-13 17:25:48 -07:00
apparmorfs.c apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock 2020-01-09 10:19:02 +01:00
audit.c apparmor: Fix memory leak of rule on error exit path 2018-06-07 01:50:48 -07:00
capability.c LSM: generalize flag passing to security_capable 2020-01-23 08:21:29 +01:00
crypto.c
domain.c apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock 2020-01-09 10:19:02 +01:00
file.c apparmor: Check buffer bounds when mapping permissions mask 2018-07-19 16:24:43 -07:00
ipc.c LSM: generalize flag passing to security_capable 2020-01-23 08:21:29 +01:00
Kconfig
label.c apparmor: fix unsigned len comparison with less than zero 2020-01-04 19:13:08 +01:00
lib.c apparmor: Fix uninitialized value in aa_split_fqname 2018-11-27 16:13:00 +01:00
lsm.c apparmor: don't try to replace stale label in ptrace access check 2020-01-27 14:49:55 +01:00
Makefile apparmor: add base infastructure for socket mediation 2018-03-13 17:25:48 -07:00
match.c apparmor: fix typo "traverse" 2018-05-03 00:50:12 -07:00
mount.c apparmor: fix typo "independent" 2018-05-03 00:50:30 -07:00
net.c apparmor: Fix network performance issue in aa_label_sk_perm 2020-01-27 14:49:54 +01:00
nulldfa.in apparmor: cleanup add proper line wrapping to nulldfa.in 2018-02-09 11:30:01 -08:00
path.c
policy.c apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock 2020-01-09 10:19:02 +01:00
policy_ns.c apparmor: fix an error code in __aa_create_ns() 2018-08-21 16:24:56 -07:00
policy_unpack.c apparmor: reset pos on failure to unpack for various functions 2019-09-16 08:22:16 +02:00
procattr.c apparmor: move context.h to cred.h 2018-02-09 11:30:01 -08:00
resource.c LSM: generalize flag passing to security_capable 2020-01-23 08:21:29 +01:00
secid.c apparmor: fix bad debug check in apparmor_secid_to_secctx() 2018-09-03 11:15:29 -07:00
stacksplitdfa.in apparmor: use the dfa to do label parse string splitting 2018-02-09 11:30:01 -08:00
task.c apparmor: update domain transitions that are subsets of confinement at nnp 2018-02-09 11:30:01 -08:00