[lxc-devel] [lxc/lxc] dd1d77: Remove process_lock() except where actually needed
GitHub
noreply at github.com
Tue Dec 24 15:11:18 UTC 2013
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: dd1d77f91b3eb5b9b02f97d81c6c1c6c29563c03
https://github.com/lxc/lxc/commit/dd1d77f91b3eb5b9b02f97d81c6c1c6c29563c03
Author: Andrey Mazo <mazo at telum.ru>
Date: 2013-12-24 (Tue, 24 Dec 2013)
Changed paths:
M src/lxc/af_unix.c
M src/lxc/attach.c
M src/lxc/bdev.c
M src/lxc/caps.c
M src/lxc/cgroup.c
M src/lxc/commands.c
M src/lxc/conf.c
M src/lxc/console.c
M src/lxc/freezer.c
M src/lxc/log.c
M src/lxc/lsm/apparmor.c
M src/lxc/lxccontainer.c
M src/lxc/lxclock.c
M src/lxc/lxcutmp.c
M src/lxc/mainloop.c
M src/lxc/monitor.c
M src/lxc/network.c
M src/lxc/nl.c
M src/lxc/parse.c
M src/lxc/seccomp.c
M src/lxc/start.c
M src/lxc/state.c
M src/lxc/sync.c
M src/lxc/utils.c
M src/lxc/utils.h
Log Message:
-----------
Remove process_lock() except where actually needed
Functions like open(), close(), socket(), socketpair(), pipe() and mkdir()
are generally thin wrappers around kernel-provided system calls.
It's the kernel not libc, who ensures race-free handling of file
descriptors.
Thus locking around these functions is unnecessary even on somewhat buggy libcs.
fopen(), fclose() and other stdio functions may maintain internal lists
of open file handles and thus can be prone to race-conditions.
Hopefully, most libcs utilize proper locking or other ways to ensure
thread-safety of these functions.
Bionic used to have non-thread-safe stdio [2] but that must be fixed
since android 4.3 [3, 4].
S.Çağlar Onur showed [1] that openpty() (because of nsswitch) is not thread-safe though.
So we workaround it by protecting openpty() calls with process_lock()/process_unlock().
Because of the need to guard openpty() with process_lock()/process_unlock(),
process_unlock() is still used after fork().
This commit reverts most of 025ed0f3911836b71f498d8368725c77a7e1932a.
[1] https://github.com/lxc/lxc/pull/106#issuecomment-31077269
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=687367
[3] https://android.googlesource.com/platform/bionic/+/f582340a6a48588aa50da17e1620e8f91b146941
[4] https://android.googlesource.com/platform/bionic/+/6b3f49a5374305ce9690c3c5ca2aadc90f54c521
Signed-off-by: Andrey Mazo <mazo at telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Commit: aaf901be6be03c5dc09de2d5cfe5fb19f5103a1d
https://github.com/lxc/lxc/commit/aaf901be6be03c5dc09de2d5cfe5fb19f5103a1d
Author: Andrey Mazo <mazo at telum.ru>
Date: 2013-12-24 (Tue, 24 Dec 2013)
Changed paths:
M src/lxc/conf.c
Log Message:
-----------
Use getmntent_r() for thread-safety
Signed-off-by: Andrey Mazo <mazo at telum.ru>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Compare: https://github.com/lxc/lxc/compare/e339d6b9c1b8...aaf901be6be0
More information about the lxc-devel
mailing list