From: Jann Horn <jannh@google.com>
To: John Johansen <john.johansen@canonical.com>,
apparmor@lists.ubuntu.com, jannh@google.com
Cc: linux-kernel@vger.kernel.org,
Cyrill Gorcunov <gorcunov@gmail.com>,
kernel test robot <rong.a.chen@intel.com>
Subject: [PATCH] apparmor: don't try to replace stale label in ptraceme check
Date: Sat, 29 Sep 2018 03:49:26 +0200 [thread overview]
Message-ID: <20180929014926.227002-1-jannh@google.com> (raw)
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>
---
security/apparmor/lsm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 8c7f46a6a8dc..0f56431b4b2f 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -131,11 +131,11 @@ static int apparmor_ptrace_traceme(struct task_struct *parent)
struct aa_label *tracer, *tracee;
int error;
- tracee = begin_current_label_crit_section();
+ tracee = __begin_current_label_crit_section();
tracer = aa_get_task_label(parent);
error = aa_may_ptrace(tracer, tracee, AA_PTRACE_TRACE);
aa_put_label(tracer);
- end_current_label_crit_section(tracee);
+ __end_current_label_crit_section(tracee);
return error;
}
--
2.19.0.605.g01d371f741-goog
next reply other threads:[~2018-09-29 1:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-29 1:49 Jann Horn [this message]
2018-09-29 4:38 ` John Johansen
2018-09-29 23:23 ` kbuild test robot
2018-09-29 23:38 ` Jann Horn
2018-09-30 4:34 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180929014926.227002-1-jannh@google.com \
--to=jannh@google.com \
--cc=apparmor@lists.ubuntu.com \
--cc=gorcunov@gmail.com \
--cc=john.johansen@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rong.a.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®