different behavior of socket()/setsocketopt()/poll() in chroot?

ipif ipif at ymail.com
Tue May 12 15:03:49 UTC 2009


Hi,

I'm still coping with my embedded sparc system. After having applied lots of
patches and fixed several system calls (I promise to post them soon) I'm now
evaluating the mini_fo overlay filesystem. With this, the whole system runs
in a chroot environment. Everything seems to work fine, but ntpdate does not
run properly any more. As I run the same binary in both environments I
assume that this is more a system related issue.
For the chroot environment I use the following script as init, the rest is
identical:

mount -t tmpfs -o rw,size=32M none ${MOUNT_OVERLAY}
mount -t mini_fo -o base=/,sto=${MOUNT_OVERLAY} / ${MOUNT_ROOT}
exec chroot ${MOUNT_ROOT} /sbin/init

Running strace the initial parts are identical:
# strace ntpdate -u <server>
[...]
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
rt_sigaction(SIGALRM, {0x11524, [], 0}, {SIG_DFL, [], 0}, 0x50026cf4, 4) = 0
setitimer(ITIMER_REAL, {it_interval={0, 200000}, it_value={0, 100000}},
NULL) = 0
setpriority(PRIO_PROCESS, 0, -12)       = 0

On the original system the following happens:
poll([{fd=3, events=POLLIN}], 1, 60000) = -1 EINTR (Interrupted system call)
--- SIGALRM (Alarm clock) @ 0 (0) ---
[...]
exit(0)                                 = ?

On the chrooted one:
poll([{fd=3, events=POLLIN}], 1, 60000) = 0 (Timeout)
[...]
poll([{fd=3, events=POLLIN}], 1, 60000) = 0 (Timeout)
[...]
and so on.

All other programs that rely on network connections (ssh, webserver, etc.)
run normally. Maybe it's related to poll().
I'm using uclibc-0.9.30 and linux-2.6.21.

Sorry, I've no idea if this is really uclibc related, but perhaps someone of
you can give me a hint how to debug this problem.

Thanks,
-jan
-- 
View this message in context: http://www.nabble.com/different-behavior-of-socket%28%29-setsocketopt%28%29-poll%28%29-in-chroot--tp23504365p23504365.html
Sent from the uClibc mailing list archive at Nabble.com.



More information about the uClibc mailing list