Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH3] Re: avoid closed stdin() in zle widgets



2017-06-12 09:09:23 -0700, Bart Schaefer:
> On Mon, Jun 12, 2017 at 8:34 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> 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



Messages sorted by: Reverse Date, Date, Thread, Author