bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] opening files with O_NONBLOCK causes problems


From: Joerg Schilling
Subject: Re: [Bug-tar] opening files with O_NONBLOCK causes problems
Date: Fri, 06 Jan 2012 15:22:53 +0100
User-agent: nail 11.22 3/20/05

Eric Blake <address@hidden> wrote:

> On 01/06/2012 07:10 AM, Joerg Schilling wrote:
> >> The question is not why an archiver opens a FIFO file, but what it does
> >> after opening a file O_NONBLOCK (the TOCTTOU race is eliminated by
> >> switching stat()/open() to open()/fstat() filtering, and once we have
> >> ascertained that an open fd is not a FIFO, if we can then use fcntl() to
> >> remove the O_NONBLOCK, hopefully that will resolve the situation with DMF).
> > 
> >From the mail from the OP, this will still trigger the problem as the open 
> >will 
> > already return EWOULDBLOCK instead of fetching the file from the background 
> > storage.
>
> Huh?  From the OP:
>
> openat(AT_FDCWD, "qsub_allocation.patch",
> O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW|O_CLOEXEC) = 4
> ...
> read(4, 0x654200, 2986)                 = -1 EAGAIN (Resource
> temporarily unavailable)
>
> The open() succeeded, not failing with EWOULDBLOCK.  It wasn't until the
> read() that things failed, and that was only because there was no
> intervening fcntl() on fd 4 to clear the O_NONBLOCK flag.

OK, it seems that I did not remember the OP correctly.

In any case, the way star handles the problem since 27 years will just hang in 
case of an attack and there was no related bug report sinde then.

Jörg

-- 
 EMail:address@hidden (home) Jörg Schilling D-13353 Berlin
       address@hidden                (uni)  
       address@hidden (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily



reply via email to

[Prev in Thread] Current Thread [Next in Thread]