diff options
| author | Jann Horn <jannh@google.com> | 2018-09-28 21:49:26 -0400 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2018-10-03 09:29:22 -0400 |
| commit | ca3fde5214e1d24f78269b337d3f22afd6bf445e (patch) | |
| tree | 74d474a553b59e9b0bcc1bf5627047f9bf3023f2 /security | |
| parent | 0fb871cc42537465e322f727bec6abfd375faa83 (diff) | |
apparmor: don't try to replace stale label in ptraceme check
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>
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 2c842f24821b..d08aac05c65a 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
| @@ -132,11 +132,11 @@ static int apparmor_ptrace_traceme(struct task_struct *parent) | |||
| 132 | struct aa_label *tracer, *tracee; | 132 | struct aa_label *tracer, *tracee; |
| 133 | int error; | 133 | int error; |
| 134 | 134 | ||
| 135 | tracee = begin_current_label_crit_section(); | 135 | tracee = __begin_current_label_crit_section(); |
| 136 | tracer = aa_get_task_label(parent); | 136 | tracer = aa_get_task_label(parent); |
| 137 | error = aa_may_ptrace(tracer, tracee, AA_PTRACE_TRACE); | 137 | error = aa_may_ptrace(tracer, tracee, AA_PTRACE_TRACE); |
| 138 | aa_put_label(tracer); | 138 | aa_put_label(tracer); |
| 139 | end_current_label_crit_section(tracee); | 139 | __end_current_label_crit_section(tracee); |
| 140 | 140 | ||
| 141 | return error; | 141 | return error; |
| 142 | } | 142 | } |
