The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Laura Abbott <labbott@redhat.com>
To: Tom Horsley <horsley1953@gmail.com>,
	linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>
Cc: David Howells <dhowells@redhat.com>,
	Serge Hallyn <serge@hallyn.com>,
	James Morris <james.l.morris@oracle.com>
Subject: Re: ptrace versus setuid changes in 4.14?
Date: Fri, 22 Dec 2017 12:28:25 -0800	[thread overview]
Message-ID: <ddbb8e2e-895e-8377-ed02-8950404e9708@redhat.com> (raw)
In-Reply-To: <20171221091811.5bbb47db@tomh>

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@chromium.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@redhat.com>
     Signed-off-by: Kees Cook <keescook@chromium.org>
     Acked-by: Serge Hallyn <serge@hallyn.com>
     Reviewed-by: James Morris <james.l.morris@oracle.com>


Is it time to think about reverting?

Thanks,
Laura

  reply	other threads:[~2017-12-22 20:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 14:18 ptrace versus setuid changes in 4.14? Tom Horsley
2017-12-22 20:28 ` Laura Abbott [this message]
2017-12-22 20:55   ` Tom Horsley
2017-12-22 23:14     ` Kees Cook

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=ddbb8e2e-895e-8377-ed02-8950404e9708@redhat.com \
    --to=labbott@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=horsley1953@gmail.com \
    --cc=james.l.morris@oracle.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge@hallyn.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