This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/6865] New: fallback posix_fallocate() implementation is racy
- From: "bdonlan at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 2 Sep 2008 01:28:20 -0000
- Subject: [Bug libc/6865] New: fallback posix_fallocate() implementation is racy
- Reply-to: sourceware-bugzilla at sourceware dot org
The fallback implementation of posix_fallocate() in
sysdeps/posix/posix_fallocate*.c does a loop over the file, reading a byte,
checking that it is zero, and writing it back. If another application is writing
to the file at the same time, this can result in random data corruption.
One possible solution would be to mmap in the file, then trigger page faults
using atomic operations such as gcc's __sync_bool_compare_and_swap; note that
this can sometimes put too much pressure on the kernel - I've triggered OOM
kills on older linux kernels (2.6.18 xen kernels) this way - and the stat()
block count may remain out of date until a sync() call or until the dirty pages
pass through the filesystem driver.
--
Summary: fallback posix_fallocate() implementation is racy
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: bdonlan at gmail dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=6865
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.