DragonFly BSD
DragonFly commits List (threaded) for 2013-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

git: socket: Avoid possible race between netmsg_so_notify() and sowakeup()


From: Sepherosa Ziehau <sephe@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Jul 2013 02:24:59 -0700 (PDT)

commit ccae972d65bbf7c434fd030a3f6dd886e57cbc3d
Author: Sepherosa Ziehau <sephe@dragonflybsd.org>
Date:   Fri Jul 19 16:40:07 2013 +0800

    socket: Avoid possible race between netmsg_so_notify() and sowakeup()
    
    The race is concerning SSB_MEVENT setup and testing.  Originally:
    
                 CPU X                          CPU Y
        get token                                 :
        if (predict cond false) {                 :
               :                        set predict cond true
               :                        if (SSB_MEVENT) {
               :                            get token
               :                            wake up notifies
               :                            rel token
               :                        }
            queue notify                          :
            set SSB_MEVENT                        :
        }                                         :
        rel token
    
    This commit always set SSB_MEVENT before predict testing, after getting
    the socket token, so the race could be avoided.
    
    Reviewed-by: dillon@

Summary of changes:
 sys/kern/uipc_msg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]