git: kernel - Fix rare allproc scan vs p_ucred race

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Sep 26 21:34:55 PDT 2017


commit 6cbfbdb972fd2d15f247741880322725f3ce638a
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Sep 26 21:31:04 2017 -0700

    kernel - Fix rare allproc scan vs p_ucred race
    
    * This race can occur because p->p_ucred can change out from under
      an allproc scan when the allproc scan is filtering based on
      credentials.
    
    * Access p->p_ucred via the per-process spinlock (p->p_spin).  Also
      maintain a  cache of the last ucred during the loop in order to
      avoid having to spin-lock every process.
    
    * Add missing spinlock around p->p_ucred = NULL in exit1().  This
      is also only applicable to races against allproc scans since
      p_token is held during exit1().
    
    Reported-by: mjg_

Summary of changes:
 sys/kern/kern_exit.c | 10 ++++++++--
 sys/kern/kern_proc.c | 46 +++++++++++++++++++++++++++++++++++++---------
 sys/sys/proc.h       |  7 +++++--
 3 files changed, 50 insertions(+), 13 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6cbfbdb972fd2d15f247741880322725f3ce638a


-- 
DragonFly BSD source repository



More information about the Commits mailing list