linux-user NPTL problem with signals
I'm running a multi-threaded program (linux-user on i386). I have a problem with signals; when one arrives, the running thread abruptly changes :-(
Anyone have any ideas about this?
Signature · 4 lines
------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------
Quoted 6 lines · Gary Thomas
I'm running a multi-threaded program (linux-user on i386). I have a problem with signals; when one arrives, the running thread abruptly changes :-(
Anyone have any ideas about this?
I've tracked this down to the fact that there should be a unique value for the GS segment register (at least) per thread. This doesn't seem to be the case and when a signal is dispatched, the GS segment register is updated with [probably] the most recent value created by a new thread, not the running thread.
Hence, I see this:
qemu: got signal 17, pthread: 0x62289840
queue_signal: sig=17, pthread: 0x62289840
qemu: process signal 17
setup_sigcontext.757 (pthread: 0x62289840) - GS: 0x33/0x43e6f110 do_sigreturn, pthread: 0x62289840
restore_sigcontext.973 (pthread: 0x62289840) - GS: 0x33/0x43e6f110 cpu_x86_load_seg_cache.727 - pthread: 0x62289840, GS: 0x33/0x454c3b70 restore_sigcontext.975 (pthread: 0x62289840) - GS: 0x33/0x454c3b70
The GS values printed are the 'selector' and 'base' respectively. The 'base' value happens to be the Linux pthread_self() [for the emulated process]. You can see that this is switching threads but the system has not really switched threads...
Any help?
Signature · 4 lines
------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------
Quoted 5 lines · Gary Thomas
Quoted 4 lines · Gary Thomas
I'm running a multi-threaded program (linux-user on i386). I have a problem with signals; when one arrives, the running thread abruptly changes :-(
Quoted 8 lines
Quoted 2 lines
Anyone have any ideas about this?
I've tracked this down to the fact that there should be a unique value for the GS segment register (at least) per thread. This doesn't seem to be the case and when a signal is dispatched, the GS segment register is updated with [probably] the most recent value created by a new thread, not the running thread.
Nasty. NPTL is not the only software which depends on the segment registers keeping their correct values. Wine, DOSemu among others depend on all the segment registers.
-- Jamie