[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202203181019.434DA4186@keescook>
Date: Fri, 18 Mar 2022 10:20:46 -0700
From: Kees Cook <keescook@...omium.org>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Alexey Gladkov <legion@...nel.org>,
Kyle Huey <me@...ehuey.com>, Oleg Nesterov <oleg@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>, linux-api@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH 1/2] ptrace: Move setting/clearing ptrace_message into
ptrace_stop
On Fri, Mar 18, 2022 at 09:44:30AM -0500, Eric W. Biederman wrote:
> Kees Cook <keescook@...omium.org> writes:
>
> > On Tue, Mar 15, 2022 at 06:21:08PM -0500, Eric W. Biederman wrote:
> >>
> >> Today ptrace_message is easy to overlook as it not a core part of
> >> ptrace_stop. It has been overlooked so much that there are places
> >> that set ptrace_message and don't clear it, and places that never set
> >> it. So if you get an unlucky sequence of events the ptracer may be
> >> able to read a ptrace_message that does not apply to the current
> >> ptrace stop.
> >>
> >> Move setting of ptrace_message into ptrace_stop so that it always gets
> >> set before the stop, and always gets cleared after the stop. This
> >> prevents non-sense from being reported to userspace and makes
> >> ptrace_message more visible in the ptrace helper functions so that
> >> kernel developers can see it.
> >>
> >> Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> >
> > This looks good to me. Did you happen to run the seccomp selftests
> > before/after these changes?
>
> I did not. This is a pure ptrace change. Do you see a way that seccomp
> could be involved?
Sorry, that wasn't clear: seccomp includes a number of ptrace tests as
well, especially involving handling process death, messages, and
signals. I'll give it a spin; so far it seems fine.
--
Kees Cook
Powered by blists - more mailing lists