kernel - Be nicer to pthreads in vfork()
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 28 Jul 2016 17:12:39 +0000 (10:12 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 28 Jul 2016 17:50:08 +0000 (10:50 -0700)
commit5e416352dc5bd0732596c4da68625cbaf2dc9155
tree496d834b98968a99489685f211f6c74757e87b33
parent92e10cbe8bcf053cad0b647bd29a30c52d3ed4f2
kernel - Be nicer to pthreads in vfork()

* When vfork()ing, give the new sub-process's lwp the same TID as the one
  that called vfork().  Even though user processes are not supposed to do
  anything sophisticated inside a vfork() prior to exec()ing, some things
  such as fileno() having to lock in a threaded environment might not be
  apparent to the programmer.

* By giving the sub-process the same TID, operations done inside the
  vfork() prior to exec that interact with pthreads will not confuse
  pthreads and cause corruption due to e.g. TID 0 clashing with TID 0
  running in the parent that is running concurrently.
sys/kern/kern_fork.c