Bad file access on the rise
Doug Ledford
dledford at redhat.com
Sun Jun 9 20:55:40 UTC 2013
On 06/09/2013 11:42 AM, Matthew Garrett wrote:
> On Sun, Jun 09, 2013 at 11:05:44AM -0400, Doug Ledford wrote:
>
>> And really, we've spent more time on this thread than it would take
>> Lennart to fix PA. Just a quick stat and check of uid before trying to
>> remove the stale files and this would all go away. Sure, your stat and
>> remove could race, but this is nothing more than a garbage collection
>> process anyway, so who cares? We'll just get it next time.
>
> "Stat and then open" is inherently open to race conditions.
Of course it is.
> In this
> specific case it probably doesn't realistically matter,
Exactly my point.
> but it's not
> behaviour that should be encouraged.
I would never encourage it in terms of suggesting people try to second
guess the kernel's rules and limitations. However, you can use such a
technique to weed out otherwise known to fail cases, at least in
instances like this where it is a garbage collection operation and
failure to guess properly is obviously far from critical.
> The only way to know for certain
> whether you're going to be able to open or unlink a file is to attempt
> to open or unlink that file, and we shouldn't encourage people to think
> otherwise.
Agreed.
More information about the devel
mailing list