3507
|
|
plainbox:vendor:extcmd use process-wide signal masks
This patch changes extcmd to use process-wide signal masks (aka sigprocmask vs pthread_sigmask). This fixes a problem where in a multi-threaded application, extcmd might misbehave if the SIGCHLD signal was delivered to a different thread than the one running extcmd's event loop. When that happens the signal itself is consumed and subsequent read from signalfd() would return EAGAIN (aka errno 11, aka BlockingIOError).
The precise sequence of events that need to happen in order to trigger this bug is:
- assume that there is a process P1, running two threads T1 and T2. Extcmd is running in T1 and has blocked SIGCHLD (so that it can be collected via epoll-triggered signalfd). T2 runs unrelated code. - assume that there is a process P2, that is a child of P1, that has just exited. - the signal is enqueued as readable via signalfd, waking up T1 - since P1's T1 is blocking SIGCHLD, the signal is delivered to T2. - T1 tries to read() from signalfd and receives EAGAIN
The patch fixes this so that no matter how the scheduling orders events, this will happen:
- assume that there is a process P1, running two threads T1 and T2. Extcmd is running in T1 and has blocked SIGCHLD (so that it can be collected via epoll-triggered signalfd). T2 runs unrelated code. - assume that there is a process P2, that is a child of P1, that has just exited. - the signal is enqueued as readable via signalfd, waking up T1 - since P1 is blocking SIGCHLD for all threads the signal is not delivered - T1 reads signal details from signalfd
Fixes: https://bugs.launchpad.net/plainbox/+bug/1402421
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
|
Zygmunt Krynicki |
9 years ago
|
|
|
3506
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3505
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3504
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3503
|
|
|
Launchpad Translatio... |
9 years ago
|
|
|
3502
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3501
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3500
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3499
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3498
|
|
|
Maciej Kisielewski |
9 years ago
|
|
|
3497
|
|
|
Sylvain Pineau |
9 years ago
|
|
|
3496
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3495
|
|
|
Sylvain Pineau |
9 years ago
|
|
|
3494
|
|
|
Maciej Kisielewski |
9 years ago
|
|
|
3493
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3492
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3491
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3490
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|
3489
|
|
|
Daniel Manrique |
9 years ago
|
|
|
3488
|
|
|
Zygmunt Krynicki |
9 years ago
|
|
|