zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>,
	"zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH3] Re: avoid closed stdin() in zle widgets
Date: Mon, 12 Jun 2017 20:02:18 +0100	[thread overview]
Message-ID: <20170612190218.GA12445@chaz.gmail.com> (raw)
In-Reply-To: <CAH+w=7Yz=-4PRhERx1Ogq41MUg6QjvL0NDoyWExDC1=NDoa2kw@mail.gmail.com>

2017-06-12 09:09:23 -0700, Bart Schaefer:
> On Mon, Jun 12, 2017 at 8:34 AM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > Stephane Chazelas wrote on Mon, 12 Jun 2017 16:19 +0100:
> >> please find a 3rd version of the patch below with the requested
> >> change:
> >
> > it didn't seem
> > "antisocial" to me, however surprised a main() function might be
> 
> Yeah, maybe I'm just getting crotchety but that remark seemed a bit
> snarky for a NEWS entry.

Please feel free to adjust to "proper English", English is not
my mother tongue. That's inspired from the Unix v7 (1979)
wording for "rm" where rm won't accept to remove ".." because of
the "antisocial behaviour" of "rm -rf .*".

My point is that a command should be able to reasonably make some
assumptions, like:

- stdin should be open for at least reading
- stdout, stderr should be open for at least writing
- argv[0] should be set (argc > 0)
- the SIGCHLD handler should not be SIGIGN
- some reasonable limits (as in, not too low) on stacksize,
  datasize, descriptors, filesize
- no dups in the environment
- we could even maybe extend that to some variables like
  FIGNORE, IFS, CDPATH, PS1 not in the environment
- and all the possible corner cases you can imagine that only
  perverted applications would ever subject you to.

If you code can't handle any of those, arguably, you've got a
bug, but one may also argue that the environment is to
blame and not the application.

Like if you call an application with no argv[] or no stdin and
it segfaults, you asked for it, you've been antisocial. 

(of course, there's the problem of those bugs being exploited in
setuid/setgid contexts but here the problem is the
setuid/setgid that is simply not workable. And yes, we have to
deal with it, we can't just ignore it).

$ (limit stacksize 100k; zsh)
zsh: segmentation fault
zsh: segmentation fault

(twice!?). Is that a bug?

-- 
Stephane


  reply	other threads:[~2017-06-12 19:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-11 18:20 [PATCH] " Stephane Chazelas
2017-06-12  4:15 ` Eric Cook
2017-06-12  6:05   ` [PATCH2] " Stephane Chazelas
2017-06-12 14:34     ` Daniel Shahaf
2017-06-12 15:10       ` Stephane Chazelas
2017-06-12 15:19         ` [PATCH3] " Stephane Chazelas
2017-06-12 15:34           ` Daniel Shahaf
2017-06-12 16:09             ` Bart Schaefer
2017-06-12 19:02               ` Stephane Chazelas [this message]
2017-06-14 22:44                 ` Bart Schaefer
2017-06-15  8:42                   ` Stephane Chazelas
2017-06-17  3:03                     ` Bart Schaefer

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=20170612190218.GA12445@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).