[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d480ed40-13ce-9534-3214-7c6d0559e6b6@canonical.com>
Date: Fri, 28 Sep 2018 21:38:50 -0700
From: John Johansen <john.johansen@...onical.com>
To: Jann Horn <jannh@...gle.com>, apparmor@...ts.ubuntu.com
Cc: linux-kernel@...r.kernel.org, Cyrill Gorcunov <gorcunov@...il.com>,
kernel test robot <rong.a.chen@...el.com>
Subject: Re: [PATCH] apparmor: don't try to replace stale label in ptraceme
check
On 09/28/2018 06:49 PM, Jann Horn wrote:
> 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.
>
yep, thanks
I've pulled this into my tree and will send it up with another fix
Acked-by: John Johansen <john.johansen@...onical.com>
> Fixes: b2d09ae449ced ("apparmor: move ptrace checks to using labels")
> Reported-by: Cyrill Gorcunov <gorcunov@...il.com>
> Reported-by: kernel test robot <rong.a.chen@...el.com>
> Signed-off-by: Jann Horn <jannh@...gle.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;
> }
>
Powered by blists - more mailing lists