Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2003 05:52:57 -0700 (PDT)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/lib/libpthread/thread thr_mutex.c
Message-ID:  <200309241252.h8OCqv3p074641@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
davidxu     2003/09/24 05:52:57 PDT

  FreeBSD src repository

  Modified files:
    lib/libpthread/thread thr_mutex.c 
  Log:
  As comments in _mutex_lock_backout state, only current thread
  can clear the pointer to mutex, not the thread doing mutex
  handoff. Because _mutex_lock_backout does not hold scheduler
  lock while testing THR_FLAGS_IN_SYNCQ and then reading mutex
  pointer, it is possible mutex owner begin to unlock and
  handoff the mutex to the current thread, and mutex pointer
  will be cleared to NULL before current thread reading it, so
  current thread will end up with deferencing a NULL pointer,
  Fix the race by making mutex waiters to clear their mutex pointers.
  While I am here, also save inherited priority in mutex for
  PTHREAD_PRIO_INERIT mutex in mutex_trylock_common just like what
  we did in mutex_lock_common.
  
  Revision  Changes    Path
  1.42      +4 -6      src/lib/libpthread/thread/thr_mutex.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309241252.h8OCqv3p074641>