Race condition on SIGCANCEL signal in POSIX timers

mail654@gmx.de mail654 at gmx.de
Tue Aug 28 07:07:27 UTC 2012


Hi,

[Please keep me on CC:, I'm not subscribed]

I'm working with current uClibc and had problems with POSIX timers.

I use the timer with SIGEV_THREAD to create one thread each timer event. It
seems there is a race condition between the thread waiting on SIGCANCEL signal
(timer_helper_thread in timer_routine.c) and the default signal handler for this
signal.
Many timer events will be lost, because they will be dequeued before
rt_sigtimedwait() could catch it.

I found a change on creating the helper thread. (Please see:
http://git.uclibc.org/uClibc/commit/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c?id=162cfaea20d807f0ae329efe39292a9b22593b41)

After reverting this change, it works for me as expected.
Could anybody remember, why this change was necessary?

I think the comment is wrong:
/*__sigaddset (&ss, SIGCANCEL); - already done by sigfillset */

Currently SIGCANCEL will not be blocked by sigfillset, I had to reenable the
__sidaddset() comment.

I already asked Denys Vlasenko via mail, but didn't get an answer so far.

Because I'm not subscribed to your bugtracker (and not intent to do so), could
anybody please report a bug against uClibc or did I miss something and this
change make any sense?


Thank you in advance,

Erik



More information about the uClibc mailing list