git: kernel - Fix memory ordering race

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Sep 14 10:40:39 PDT 2017


commit a9a062cd1350bbf6889b4e3b22b3331d49bf818c
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Sep 14 10:36:23 2017 -0700

    kernel - Fix memory ordering race
    
    * Fix a race in the mtx wait/wakeup code for situations where the
      releasing thread hands lock ownership to the waiter.  In this
      situation the waiter can sometimes succeed without having to do
      additional atomic ops.  However, this also allows speculative reads
      by the waiting cpu to preceed the lock handover.
    
    * Add an mfence to fix this problem.  Add a few cpu_sfence()s (which
      are basically NOPs on Intel) to clarify other bits of code too.

Summary of changes:
 sys/kern/kern_mutex.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

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


-- 
DragonFly BSD source repository



More information about the Commits mailing list