From: Zack Weinberg <zackw@panix.com>
To: "Carlos O'Donell" <carlos@redhat.com>,
GNU C Library <libc-alpha@sourceware.org>
Subject: Re: Undelivered Mail Returned to Sender
Date: Tue, 15 Dec 2020 19:42:34 -0500 [thread overview]
Message-ID: <CAKCAbMj4UYiazSTU0v+Z++smbcS3upOjaK6Dkc=80hoxKWKcBQ@mail.gmail.com> (raw)
In-Reply-To: <9531c4c9-2354-4c87-4453-b492afec846f@redhat.com>
I have no idea why my mail glitched like that. Sorry for the inconvenience.
On Tue, Dec 15, 2020 at 5:42 PM Carlos O'Donell <carlos@redhat.com> wrote:
>On 12/15/20 4:04 PM, Zack Weinberg wrote:
>> On Tue, Dec 15, 2020 at 3:46 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>>> On 12/15/20 8:05 AM, Zack Weinberg wrote:
>>>> When direct execution of a program fails with ENOEXEC, do not attempt
>>>> to run that program as if it were a shell script.
>>>
>>> A less-intrusive approach would be for execlp etc.'s fallback to look at the
>>> first 1024 bytes (or whatever) of the file and fail with ENOEXEC if it finds
>>> a NUL byte, before trying to exec /bin/sh on the file.
>>
>> That's a clever idea for preserving compatibility, but to do it we
>> would have to open and read the file, which could easily cause
>> problems due to e.g. lack of free file descriptor space. If we can't
>> remove this code altogether I'm not sure it's worth changing anything
>> in libc.
>>
>> POSIX recommends that the *shell* implement a similar heuristic, and
>> it appears bash already does.
>
>What shell were you using that didn't implement this?
dash doesn't, and neither does zsh --
$ bash /bin/ls; echo $?
/bin/ls: /bin/ls: cannot execute binary file
126
$ dash /bin/ls; echo $?
/bin/ls: 1: Syntax error: ")" unexpected
2
$ zsh /bin/ls; echo $?
/bin/ls:1: parse error near ')'
Also, it's pretty easy to subvert bash's heuristic:
$ dd if=/dev/urandom count=1 | tr -d '\0' > test.x
$ bash test.x
test.x: line 4: syntax error near unexpected token
`$'\333\313\353D\341\252\341N\330\313\342\a\202g\027\225\276kE!\332\315D\226/M\2669\222''
zw
next parent reply other threads:[~2020-12-16 0:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4CwXgY5nCWzFr7@mailbackend.panix.com>
[not found] ` <9531c4c9-2354-4c87-4453-b492afec846f@redhat.com>
2020-12-16 0:42 ` Zack Weinberg [this message]
2021-08-10 9:37 MAILER-DAEMON
2021-08-10 9:39 MAILER-DAEMON
2021-08-10 9:41 MAILER-DAEMON
2021-08-10 9:44 MAILER-DAEMON
2021-08-10 9:45 MAILER-DAEMON
2021-08-10 11:20 MAILER-DAEMON
2021-08-10 13:02 MAILER-DAEMON
2021-08-10 13:21 MAILER-DAEMON
2021-08-10 13:34 MAILER-DAEMON
2021-08-10 13:49 MAILER-DAEMON
2021-08-10 14:39 MAILER-DAEMON
2021-08-10 15:42 MAILER-DAEMON
2021-08-10 17:39 MAILER-DAEMON
2021-08-10 17:41 MAILER-DAEMON
2021-08-10 17:48 MAILER-DAEMON
2021-08-10 18:03 MAILER-DAEMON
2021-08-10 18:04 MAILER-DAEMON
2021-08-10 18:12 MAILER-DAEMON
2021-08-10 19:50 MAILER-DAEMON
2021-08-10 20:11 MAILER-DAEMON
2021-08-10 21:03 MAILER-DAEMON
2021-08-10 21:09 MAILER-DAEMON
2021-08-10 21:15 MAILER-DAEMON
2021-08-10 22:19 MAILER-DAEMON
2021-08-10 22:34 MAILER-DAEMON
2021-08-11 0:54 MAILER-DAEMON
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='CAKCAbMj4UYiazSTU0v+Z++smbcS3upOjaK6Dkc=80hoxKWKcBQ@mail.gmail.com' \
--to=zackw@panix.com \
--cc=carlos@redhat.com \
--cc=libc-alpha@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).