[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] ash: clear NONBLOCK flag from stdin when in foreground
From:       Rich Felker <dalias () aerifal ! cx>
Date:       2011-08-28 4:25:32
Message-ID: 20110828042532.GJ132 () brightrain ! aerifal ! cx
[Download RAW message or body]

On Sun, Aug 28, 2011 at 05:59:24AM +0200, Denys Vlasenko wrote:
> On Thursday 25 August 2011 14:47, Rich Felker wrote:
> > On Thu, Aug 25, 2011 at 03:45:33AM +0200, Laurent Bercot wrote:
> > > On Wed, Aug 24, 2011 at 11:37:11PM +0200, Denys Vlasenko wrote:
> > > > Got just a few minutes ago in a freshly opened gnome term:
> > > > 
> > > > + --------------------------
> > > > | bash: printf: write error: Interrupted system call
> > > > | $ _
> > > > |
> > > > |
> > > > 
> > > > Real world stroke again. EINTR which "can't happen" happened.
> > > 
> > >  Absolutely. So let me step in again:
> > >  http://www.skarnet.org/software/skalibs/libstddjb/safewrappers.html
> > > 
> > >  (But I do agree with you, Denys, that the best place to fix stray
> > > EINTRs would be the kernel.)
> >
> > Indeed, this is a SERIOUS KERNEL BUG with major security implications.
> > Expecting every userspace app to work around it is nonsense. 
> 
> Wrong in this particular case. printf shell builtin code can't know whether
> there are installed non-fatal handlers (say, via shell's trap mechanism),
> so it must be coded to handle EINTR correctly (that is, it should
> retry the operation). Apparently it does not.

As long as the shell implementation installs such signal handlers with
SA_RESTART, there is no need to check for EINTR and retry.

> > I would be interested in seeing how Denys was able to make it happen,
> > though. I have never seen such a thing and I'm rather skeptical.
> 
> Nothing special. I just launched Gnome terminar, and this popped up.
> It's not reproducible.

Well there must be something special since the printf command getting
executed in a new shell under a new terminal is not "normal"...

Rich
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic