This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/15661] posix_fallocate fallback code buggy and dangerous


https://sourceware.org/bugzilla/show_bug.cgi?id=15661

--- Comment #6 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Rich Felker from comment #1)
> If keeping the emulation is desirable, I do have one potential fix that
> would avoid the race condition. fork a child process (because this might
> SIGBUS if another thread or process truncates the file), possibly using
> clone to avoid the parent receiving signals from the child's termination. In
> the child, mmap the file and use atomic compare-and-swap on each page that
> should be allocated, with the comparison and new values being equal. This
> will touch each page with a write in a way that's non-destructive.

This assumes a unified page cache, which is probably not even true for all
Linux file systems.  I think it can still result in data loss.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]