[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ddbb8e2e-895e-8377-ed02-8950404e9708@redhat.com>
Date: Fri, 22 Dec 2017 12:28:25 -0800
From: Laura Abbott <labbott@...hat.com>
To: Tom Horsley <horsley1953@...il.com>, linux-kernel@...r.kernel.org,
Kees Cook <keescook@...omium.org>
Cc: David Howells <dhowells@...hat.com>,
Serge Hallyn <serge@...lyn.com>,
James Morris <james.l.morris@...cle.com>
Subject: Re: ptrace versus setuid changes in 4.14?
On 12/21/2017 06:18 AM, Tom Horsley wrote:
> On my fedora 26 box with a 4.13 kernel, when a process
> under ptrace control did an exec of a setuid program,
> the program lost all of its setuid privileges and
> ptrace could operate on it like a normal program.
>
> Experimental evidence seems to indicate that on
> fedora 27 with a 4.14 kernel, ptrace cannot
> do a PEEKDATA to read anything from the just
> execed setuid program. (I get errno 5 - I/O error).
>
> Am I confused somehow, or did something really change
> in this vicinity?
>
> It puts a real crimp in my fancy debug feature to
> patch code into a setuid program to make it re-exec itself,
> then detach from it. (I don't suppose we could get
> a setoptions feature to tell the kernel to detach
> from setuid programs automagically and let the debugger
> know it is no longer in control of the process?)
>
Assuming this is https://bugzilla.redhat.com/show_bug.cgi?id=1528633
This is yet another victim of
commit e37fdb785a5f95ecadf43b773c97f676500ac7b8 (refs/bisect/bad)
Author: Kees Cook <keescook@...omium.org>
Date: Tue Jul 18 15:25:31 2017 -0700
exec: Use secureexec for setting dumpability
The examination of "current" to decide dumpability is wrong. This was a
check of and euid/uid (or egid/gid) mismatch in the existing process,
not the newly created one. This appears to stretch back into even the
"history.git" tree. Luckily, dumpability is later set in commit_creds().
In earlier kernel versions before creds existed, similar checks also
existed late in the exec flow, covering up the mistake as far back as I
could find.
Note that because the commit_creds() check examines differences of euid,
uid, egid, gid, and capabilities between the old and new creds, it would
look like the setup_new_exec() dumpability test could be entirely removed.
However, the secureexec test may cover a different set of tests (specific
to the LSMs) than what commit_creds() checks for. So, fix this test to
use secureexec (the removed euid tests are redundant to the commoncap
secureexec checks now).
Cc: David Howells <dhowells@...hat.com>
Signed-off-by: Kees Cook <keescook@...omium.org>
Acked-by: Serge Hallyn <serge@...lyn.com>
Reviewed-by: James Morris <james.l.morris@...cle.com>
Is it time to think about reverting?
Thanks,
Laura
Powered by blists - more mailing lists