git: kernel - Fix ps/thread-exit and other related ps races

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Nov 17 09:22:10 PST 2011


commit eb2adbf513fa1db03b9e8e7b61fcaf511babd367
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Nov 17 09:04:53 2011 -0800

    kernel - Fix ps/thread-exit and other related ps races
    
    * Adjust sysctl_kern_proc()'s kernel thread scanning code to use a marker
      instead of depending on td remaining on its proper list.  Otherwise
      blocking conditions can rip td out from under us or move it to another
      cpu, potentially resulting in a crash or livelock.  Index the scan
      backwards to avoid live-locking continuous adds to the list.
    
    * Fix a potential race is the zombie removal code vs a ps, p->p_token was
      being released too early.
    
    * Adjust lwkt_exit() to wait for the thread's hold count to drop to zero
      so lwkt_hold() works as advertised.

Summary of changes:
 sys/ddb/db_ps.c        |    2 +
 sys/kern/kern_exit.c   |    3 +-
 sys/kern/kern_proc.c   |   76 +++++++++++++++++++++++++++++++++++++++++-------
 sys/kern/lwkt_thread.c |   11 +++++++
 sys/sys/thread.h       |    2 +-
 5 files changed, 81 insertions(+), 13 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/eb2adbf513fa1db03b9e8e7b61fcaf511babd367


-- 
DragonFly BSD source repository





More information about the Commits mailing list