lp:~zyga/checkbox/fix-1402421

Created by Zygmunt Krynicki and last modified
Get this branch:
bzr branch lp:~zyga/checkbox/fix-1402421
Only Zygmunt Krynicki can upload to this branch. If you are Zygmunt Krynicki please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Zygmunt Krynicki
Project:
Checkbox
Status:
Development

Recent revisions

3507. By Zygmunt Krynicki

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 <email address hidden>

3506. By Zygmunt Krynicki

plainbox:vendor:glibc: fix man page ref for pthread_sigmask

Signed-off-by: Zygmunt Krynicki <email address hidden>

3505. By Zygmunt Krynicki

plainbox:vendor:glibc: add sigprocmask

This patch adds a trivial implementation of sigprocmask, based on
_sigxxxmask_base. This allows one to use either process-wide or
per-thread signal blocks using the same API.

Signed-off-by: Zygmunt Krynicki <email address hidden>

3504. By Zygmunt Krynicki

plainbox:vendor:glibc: refactor pthread_sigmask

This patch refactors the pthread_sigmaks into a generic base class
_sigxxxmask_base that can now be used to trivially implement
pthread_sigmask and, in the upcoming patch, sigprocmask.

Signed-off-by: Zygmunt Krynicki <email address hidden>

3503. By Launchpad Translations on behalf of checkbox-dev

Launchpad automatic translations update.

3502. By Zygmunt Krynicki

"automatic merge of lp:~zkrynicki/checkbox/fix-1401996/ by tarmac [r=roadmr][bug=1401996][author=zkrynicki]"

3501. By Zygmunt Krynicki

"automatic merge of lp:~zkrynicki/checkbox/fix-1401927/ by tarmac [r=sylvain-pineau][bug=1401927][author=zkrynicki]"

3500. By Zygmunt Krynicki

"automatic merge of lp:~zkrynicki/checkbox/attachment-fixes/ by tarmac [r=sylvain-pineau][bug=1401886][author=zkrynicki]"

3499. By Zygmunt Krynicki

"automatic merge of lp:~zkrynicki/checkbox/extcmd-abnormal-end/ by tarmac [r=sylvain-pineau][bug=][author=zkrynicki]"

3498. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/fix-1399623/ by tarmac [r=zkrynicki][bug=1399623][author=kissiel]"

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
lp:checkbox
This branch contains Public information 
Everyone can see this information.

Subscribers