[lxc-devel] [lxc/lxc] ebec91: run_buffer(): unblock all signals for spawned scri...
GitHub
noreply at github.com
Fri Dec 13 21:13:20 UTC 2013
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: ebec9176c8bb039e4d3db89871322e585d88f12b
https://github.com/lxc/lxc/commit/ebec9176c8bb039e4d3db89871322e585d88f12b
Author: Andrey Mazo <mazo at telum.ru>
Date: 2013-12-03 (Tue, 03 Dec 2013)
Changed paths:
M src/lxc/bdev.c
M src/lxc/conf.c
M src/lxc/utils.c
M src/lxc/utils.h
Log Message:
-----------
run_buffer(): unblock all signals for spawned scripts.
Currently, all scripts, specified as "lxc.network.script.up", inherit
lxc-execute's signal mask.
This, for example, includes blocked SIGALRM signal which, in turn, makes
alarm(2), sleep(3) and setitimer(2) functions silently unusable in all programs,
invoked in turn by the "lxc.network.script.up".
To fix this, run_buffer() should restore default signal mask prior to
executing "lxc.network.script.up".
A naive implementation would temprorary unblock all signals just before
calling popen() and block them back immediately after it.
But that would result in an immediate delivery of all pending signals just
after their unblocking.
Thus, we should restore default signal mask exactly in child (after fork())
just before calling exec().
To achieve this, a home-brewed popen() alternative is needed.
The added lxc_popen() and lxc_pclose() are mostly taken from glibc with
several simplifications (as we currently need only "re" mode).
The implementation uses Linux-specific pipe2() system-call,
which is only available since Linux 2.6.27 and supported by glibc since
version 2.9 (according to pipe(2) man-page), but this shouldn't be a
problem as lxc requires a fairly recent kernel too.
lxc_popen()/lxc_pclose() are meant to be direct replacements for their
stdio counterparts, so they perform no process_lock() locking
themselves. (as fopen_cloexec() does)
All existing users of popen()/pclose() are converted to the new
lxc_popen()/lxc_pclose().
(mazo: don't clear close-on-exec flag for parent's end;
place the new functions in utils.c;
convert bdev.c to use the new functions;
coding style fixes;
comments fixes;
commit message tweaks)
Signed-off-by: Ivan Bolsunov <bolsunov at telum.ru>
Signed-off-by: Andrey Mazo <mazo at telum.ru>
Commit: a611bce104ddb9f76a140eab7ffc9d714a79bb9c
https://github.com/lxc/lxc/commit/a611bce104ddb9f76a140eab7ffc9d714a79bb9c
Author: hallyn <serge at hallyn.com>
Date: 2013-12-13 (Fri, 13 Dec 2013)
Changed paths:
M src/lxc/bdev.c
M src/lxc/conf.c
M src/lxc/utils.c
M src/lxc/utils.h
Log Message:
-----------
Merge pull request #101 from ahippo/master
run_buffer(): unblock all signals for spawned scripts.
Compare: https://github.com/lxc/lxc/compare/26b797f3d29a...a611bce104dd
More information about the lxc-devel
mailing list