[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#416716: libc6: ldconfig does not write /etc/ld.so.cache~ synchronously



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


-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-xen-686
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)

Versions of packages libc6 depends on:
ii  tzdata                        2007b-1    Time Zone and Daylight Saving Time

libc6 recommends no packages.

-- no debconf information



Reply to: