readlink -f still segfaults

Natanael Copa natanael.copa at gmail.com
Fri May 5 09:29:08 UTC 2006


I discovered my hotplug scripts fails caused by readlink segfaulting. I
googled and found that it has been seen before:

http://www.busybox.net/lists/busybox/2006-January/017795.html

Looks like it never got a conclusion.

I am running uclibc-0.9.28 built on gentoo-hardened and I can confirm
that 'readlink -f' segfaults on busybox v1.1.2.

I tried readlink -f on my 64 bit glibc host and it did not segfault.

Here is the output of 'strace busybox readlink -f /root'
...
close(3)                                = 0
munmap(0xf7ff3000, 4096)                = 0
munmap(0xf7ff4000, 15609)               = 0
mprotect(0x56614000, 12288, PROT_READ)  = 0
mprotect(0xf7fe0000, 4096, PROT_READ)   = 0
mprotect(0xf7fdb000, 4096, PROT_READ)   = 0
mprotect(0xf7fc2000, 4096, PROT_READ)   = 0
mprotect(0xf7ffd000, 4096, PROT_READ)   = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon
echo ...}) = 0ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig
icanon echo ...}) = 0open("/dev/urandom", O_RDONLY)          = 3
read(3, "/\372r6", 4)                   = 4
close(3)                                = 0
getuid()                                = 0
getgid()                                = 0
setgid(0)                               = 0
setuid(0)                               = 0
readlink("/root", 0xffff9eb0, 4095)     = -1 EINVAL (Invalid argument)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


and the ouput of strace -f on a link. 'strace busybox readlink
-f /etc/make.profile'
read(3, "\272~\360\336", 4)             = 4
close(3)                                = 0
getuid()                                = 0
getgid()                                = 0
setgid(0)                               = 0
setuid(0)                               = 0
readlink("/etc", 0xffffa950, 4095)      = -1 EINVAL (Invalid argument)
readlink("/etc/make.profile",
"../usr/portage/profiles/uclibc/x86/hardened", 4095) = 43
readlink("/usr", 0xffffa950, 4095)      = -1 EINVAL (Invalid argument)
readlink("/usr/portage", 0xffffa950, 4095) = -1 EINVAL (Invalid
argument)
readlink("/usr/portage/profiles", 0xffffa950, 4095) = -1 EINVAL (Invalid
argument)
readlink("/usr/portage/profiles/uclibc", 0xffffa950, 4095) = -1 EINVAL
(Invalid argument)
readlink("/usr/portage/profiles/uclibc/x86", 0xffffa950, 4095) = -1
EINVAL (Invalid argument)
readlink("/usr/portage/profiles/uclibc/x86/hardened", 0xffffa950, 4095)
= -1 EINVAL (Invalid argument)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

--
Natanael Copa




More information about the busybox mailing list