This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/15661] posix_fallocate fallback code buggy and dangerous
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 21 Jun 2013 00:59:26 +0000
- Subject: [Bug libc/15661] posix_fallocate fallback code buggy and dangerous
- Auto-submitted: auto-generated
- References: <bug-15661-131 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=15661
--- Comment #1 from Rich Felker <bugdal at aerifal dot cx> ---
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.
--
You are receiving this mail because:
You are on the CC list for the bug.