[PATCH] ash: clear NONBLOCK flag from stdin when in foreground

Denys Vlasenko vda.linux at googlemail.com
Sun Aug 28 03:59:24 UTC 2011


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.


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

-- 
vda


More information about the busybox mailing list