On Fri, Mar 30, 2007 at 09:31:34AM +1000, Russell Coker wrote: > Package: libc6 > Version: 2.3.6.ds1-13 > Severity: normal > > Below is part of the strace output from running "ldconfig" with no > parameters. As you can see the O_SYNC parameter is not used for the open() > system call and the fsync() system call is not used to sync the file to disk > before closing it. > > This means that if the system has a power failure immediately after a rename > the file /etc/ld.so.cache may have corrupt contents. I have seen this happen > on a real system (it's not a theoretical bug). > > unlink("/etc/ld.so.cache~") = -1 ENOENT (No such file or > directory) > open("/etc/ld.so.cache~", O_WRONLY|O_CREAT|O_TRUNC|O_NOFOLLOW, 0644) = 3 > write(3, "ld.so-1.7.0\0\376\2\0\0\3\0\0\0\310L\0\0\322L\0\0\3\0\0"..., 9208) > = 9208 > write(3, "", 0) = 0 > write(3, "glibc-ld.so.cache1.11\3\0\0m\213\0\0\0\0\0\0"..., 19656) = 19656 > write(3, "libz.so.1\0/usr/lib/libz.so.1\0lib"..., 35693) = 35693 > close(3) = 0 > chmod("/etc/ld.so.cache~", 0644) = 0 > rename("/etc/ld.so.cache~", "/etc/ld.so.cache") = 0
Given that it uses a temporary file, a fsync should be enough IMHO. O_SYNC looks like an overkill. -- ·O· Pierre Habouzit ··O [EMAIL PROTECTED] OOO http://www.madism.org
pgptMMOAvYGpO.pgp
Description: PGP signature