On Tue, Oct 30, 2012 at 11:57:05AM -0400, Okan Demirmen wrote: > On Tue, Oct 30, 2012 at 11:53 AM, Christiano F. Haesbaert > <[email protected]> wrote: > > On 30 October 2012 16:52, Christiano F. Haesbaert > > <[email protected]> wrote: > >> On 30 October 2012 16:45, Okan Demirmen <[email protected]> wrote: > >>> On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert > >>> <[email protected]> wrote: > >>>> On 30 October 2012 15:03, Christiano F. Haesbaert > >>>> <[email protected]> wrote: <snip> > >>>> That should be an access(2) call. > >>>> > >>> > >>> or stat(2) due to tctu. > >> > >> I believe in that case it would be the same, since there is still a > >> window between stat(2)/access(2) and open(2). > > > > I mean, considering he would open/stat/close and open again. > > I didn't actually look at the code; I just noticed the words > permission and access(2) and hit reply :) >
Perhaps you meant fstat? Looking at the code, it doesn't look like there's any way to fix the TOCTOU issue without resorting to a complete overhaul, and instead using the openat() family of calls. OTOH, it looks like the permission check is just for sanity--early failure.
