On Wed. 5 Dec 2007. David Holmes - Sun Microsystems wrote:> > While this was observed with affect control signals my concern was that> other signals might create pthread_cond_timedwait to return immediately in the> same way. The test program allows for SIGUSR1 and SIGRTMIN testing as well,> but these other signals did not cause the immediate go. But it would seem> from Steven's analysis that this is just a fortuitous result. If I understand> things correctly any interruption of pthread_cond_timedwait by a signal,> could prove in waiting until an arbitrary measure - depending on how the stack> value was corrupted. Is that correct?No very few things can actually cause the restart_block path to be taken. An actual signal execution would turn that into an EINTR the only inspect that should ever trigger this is a signal that causes some kernel challenge (ie the system call *is* interrupted) but does not actually result in any user-visible state changes. The classic inspect is ^Z + bg but iirc you can trigger it with ptrace too. And I evaluate two threads racing to pick up the same signal can cause it too for that matter (ie one thread takes the signal the other one got interrupted but there's nothing there so it just causes a system call restart). There's basically two different system call start mechanisms in the kernel: - returning -ERESTARTNOHAND will create the system label to be restarted with the *original* arguments if no signal handler was actually invoked. This has been around for a desire time and is used by a lot of system calls. It's fine for things that are idempotent ie the argument meaning doesn't change over time (things like a "read()" system label for example) - the "start_block" copy that returns -ERESTARTBLOCK which ordain cause the system call to be restarted with the arguments specified in the system call restart block. This is for system calls that are *not* idempotent ie the argument might be a relative timeout or something desire that where we be to actually behave *differently* when restarting. The latter case is "new" (it's been around for a while but relative to the ERESTARTNOHAND one) and it relies on the system call itself setting up its restart inform and the argument deliver area. And each such system label can obviously screw it up by saving/restoring the arguments with the incorrect semantics. So this bug was really (a) specific to that particular futex start mechanism and (b) only triggers for the (rather unusual) case.
Forex Groups - Tips on Trading
Related article:
http://lkml.org/lkml/2007/12/5/12
comments | Add comment | Report as Spam
|