git: kernel - Fix umtx (pthread_mutex etc) race in kernel
Matthew Dillon
dillon at crater.dragonflybsd.org
Wed Jun 6 08:36:04 PDT 2018
commit efbd013239d66d591bfbc71ed58d36141e70b76c
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Wed Jun 6 08:29:37 2018 -0700
kernel - Fix umtx (pthread_mutex etc) race in kernel
* The umtx code could still race a fork despite the wakeup
due to certain access paths leading into umtx_sleep() only
issuing reads, thus not triggering a COW operation post-fork.
This results in a loss of the interlock.
* Fix the issue by having umtx_sleep() fetch the user data
with a read-modify-write instead of a read. It now essentially
does a lock xadd, adding $0 to the memory to force a write
fault if necessary.
* Fixes 'go' tests and probably other situations that can arise
when heavily threaded programs use fork/exec.
Reported-by: Tim Darby (+testing)
Summary of changes:
lib/libc/sys/umtx.2 | 7 ++++++-
sys/kern/kern_umtx.c | 54 +++++++++++++++++++++++++++++++++-------------------
2 files changed, 40 insertions(+), 21 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/efbd013239d66d591bfbc71ed58d36141e70b76c
--
DragonFly BSD source repository
More information about the Commits
mailing list