linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
To: Kees Cook <keescook@chromium.org>
Cc: Richard Weinberger <richard.weinberger@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Graham Christensen <graham@grahamc.com>,
	Oleg Nesterov <oleg@redhat.com>, Michal Hocko <mhocko@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: Userspace regression in LTS and stable kernels
Date: Wed, 13 Feb 2019 20:27:43 -0500	[thread overview]
Message-ID: <CAN1fySW2mTaHmj7_uon_xZBVgPeEuYCD8e+JGOSKNwokmgZ7yg@mail.gmail.com> (raw)
In-Reply-To: <CAGXu5jJoqnX54JnHZDVxO4NRCsT6sLH4+-TPk8GqCSVp0mFNLw@mail.gmail.com>

On 13/02/2019, Kees Cook <keescook@chromium.org> wrote:
> On Wed, Feb 13, 2019 at 4:41 PM Samuel Dionne-Riel
> <samuel@dionne-riel.com> wrote:
>> Before, the interpreter was still used (assuming it wasn't cut by the
>> length), and the interpreter was free to re-read the shebang if
>> desired.
>
> So, to address the "wrong binary" problem, how about we ENOEXEC only
> if no newline or spaces are found in the string?
>

If I understand right, you're asking whether it should return NOEXEC
if, of the first 128 bytes of the shebang, there are no spaces, but a
too long shebang? I wouldn't know for sure. The behaviour would
change. Instead failing due to trying to execute a shortened path, it
would fall back to the shell interpreter interpreting the file, which,
due to the inclusion of a specific shebang, might be a wrong
assumption still. Here I believe it's still in the "undefined
behaviour" territory, but one where it fails early for the userspace.

I don't have a strong opinion, but having a special case depending on
whitespace or not (well, possibility of the interpreter being
truncated or not) feels off. As an end-user, I would rather it
truncates, and show the truncated interpreter it tried to use
(behaviour before regression), rather than fail in a way where the
libc will continue executing using another unexpected interpreter.

Thinking in the principle of least astonishment, I would be less
surprised to see a truncated path on exec() than seeing exec() use an
unexpected interpreter.

-- 
— Samuel Dionne-Riel

  reply	other threads:[~2019-02-14  1:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 17:57 Userspace regression in LTS and stable kernels Samuel Dionne-Riel
2019-02-13 18:00 ` Samuel Dionne-Riel
2019-02-13 23:36 ` Richard Weinberger
2019-02-14  0:41   ` Samuel Dionne-Riel
2019-02-14  0:54     ` Kees Cook
2019-02-14  1:27       ` Samuel Dionne-Riel [this message]
2019-02-14  1:35         ` Kees Cook
2019-02-14  3:16           ` Samuel Dionne-Riel
2019-02-14  0:41   ` Kees Cook
2019-02-14 17:56   ` Linus Torvalds
2019-02-14 20:20     ` Andrew Morton
2019-02-15  7:00       ` Greg Kroah-Hartman
2019-02-15  7:13         ` Greg Kroah-Hartman
2019-02-15  9:10         ` Michal Hocko
2019-02-15  9:20           ` Greg Kroah-Hartman
2019-02-15  9:42             ` Michal Hocko
2019-02-15 15:19               ` Sasha Levin
2019-02-15 15:52                 ` Michal Hocko
2019-02-15 16:18                   ` Samuel Dionne-Riel
2019-02-15 18:02                     ` Sasha Levin
2019-02-15 18:00                   ` Sasha Levin
2019-02-18 12:56                     ` Michal Hocko

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=CAN1fySW2mTaHmj7_uon_xZBVgPeEuYCD8e+JGOSKNwokmgZ7yg@mail.gmail.com \
    --to=samuel@dionne-riel.com \
    --cc=akpm@linux-foundation.org \
    --cc=graham@grahamc.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=oleg@redhat.com \
    --cc=richard.weinberger@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).