This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with glibc, sigaction, linux-2.0.36


Hello,

this week I stumbled over a problem with a program that repetitive sets an
signal handler for SIGALRM and then sets a timer and counts a variable in
an endless loop. I compiled the program and noticed that it doesn't seem
to do anything other then count. Tracking this down with gdb and strace I
found the problem in not getting SIGALRM after the second signal(). I got
hold on a precompiled version of the program which worked. Apparently this
one is linked against libc5. I did an strace on the precompiled version
too and noticed the difference in the system call to sigaction(). Here is
an excerpt of the relevant portions of the trace.

-------- with libc5 ---------
sigaction(SIGALRM, {0x804ca45, [], 0}, {SIG_DFL}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
--- SIGALRM (Alarm clock) ---
sigaction(SIGALRM, {0x804ca45, [], 0}, {SIG_DFL}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
--- SIGALRM (Alarm clock) ---
sigaction(SIGALRM, {0x804ca45, [], 0}, {SIG_DFL}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
--- SIGALRM (Alarm clock) ---
... this works many times

--------- with glibc ---------
sigaction(SIGALRM, {0x804c9c4, [],SA_STACK|SA_RESTART|SA_NOMASK|SA_ONESHOT|0x40e6672}, {SIG_DFL}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
--- SIGALRM (Alarm clock) ---
sigaction(SIGALRM, {0x804c9c4, [],SA_STACK|SA_RESTART|SA_NOMASK|SA_ONESHOT|0x40e6672}, {0x804c9c4, [],SA_STACK|0x4feb0}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
--- SIGINT (Interrupt) ---
+++ killed by SIGINT +++
... this was killed by me after several minutes

As I see it, the sa_flags of the struct sigaction deliverd to the system
call got scrambled. I installed the glibc src.rpm and tracked the program
down to the actual system call (linked static and dynamic with the same
result). Just before the inline assembler code the struct sigaction seemed
to be O.K.

At this point I don't know how to track this further. Any help is
appreciated.

The versions involved are:

Kernel: 2.0.36 (Release 0.7 from RH-Linux-5.2)
Glibc:  2.0.7  (Release 29  from RH-Linux-5.2)
Libc:   5.3.12 (Release 27  from RH-Linux-5.2)

Mathias Weidner


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]