[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG48ez3PCoZTqKeUJ-jLu8HtiXRf_mOcnC6AtgTc0QM0Q6VrSA@mail.gmail.com>
Date: Wed, 29 May 2019 23:02:37 +0200
From: Jann Horn <jannh@...gle.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: "Eric W . Biederman" <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
David Howells <dhowells@...hat.com>,
kernel list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ptrace: restore smp_rmb() in __ptrace_may_access()
On Wed, May 29, 2019 at 6:21 PM Oleg Nesterov <oleg@...hat.com> wrote:
> On 05/29, Jann Horn wrote:
> > --- a/kernel/ptrace.c
> > +++ b/kernel/ptrace.c
> > @@ -324,6 +324,16 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
[...]
> > mm = task->mm;
>
> while at it, could you also change this into mm = READ_ONCE(task->mm) ?
Actually, that shouldn't be necessary. The caller of
__ptrace_may_access() holds the task_lock() on the task, and that
should prevent concurrent updates of ->mm. If concurrent updates of
->mm *were* possible, we'd probably be in deep trouble here (and by
that I mean use-after-free).
Powered by blists - more mailing lists