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>
Fri, 29 Jul 2016 01:27:00 +0000 (18:27 -0700)
commitde4095f1f94fa072173dba0414f4338348149473
tree8e3a674cd571d7ac90e699e584a2879eed4080b6
parent3868955192f1a93e488564deb5e1846b96fd018a
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