git: kernel - Be nicer to pthreads in vfork()

Matthew Dillon dillon at
Thu Jul 28 10:50:16 PDT 2016

commit 5e416352dc5bd0732596c4da68625cbaf2dc9155
Author: Matthew Dillon <dillon at>
Date:   Thu Jul 28 10:12:39 2016 -0700

    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.

Summary of changes:
 sys/kern/kern_fork.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list