• Eric Dumazet's avatar
    af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress · 9d6d7f1c
    Eric Dumazet authored
    wait_for_unix_gc() reads unix_tot_inflight & gc_in_progress
    without synchronization.
    
    Adds READ_ONCE()/WRITE_ONCE() and their associated comments
    to better document the intent.
    
    BUG: KCSAN: data-race in unix_inflight / wait_for_unix_gc
    
    write to 0xffffffff86e2b7c0 of 4 bytes by task 9380 on cpu 0:
     unix_inflight+0x1e8/0x260 net/unix/scm.c:63
     unix_attach_fds+0x10c/0x1e0 net/unix/scm.c:121
     unix_scm_to_skb net/unix/af_unix.c:1674 [inline]
     unix_dgram_sendmsg+0x679/0x16b0 net/unix/af_unix.c:1817
     unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258
     sock_sendmsg_nosec net/socket.c:704 [inline]
     sock_sendmsg net/socket.c:724 [inline]
     ____sys_sendmsg+0x39a/0x510 net/socket.c:2409
     ___sys_sendmsg net/socket.c:2463 [inline]
     __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549
     __do_sys_sendmmsg net/socket.c:2578 [inline]
     __se_sys_sendmmsg net/socket.c:2575 [inline]
     __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575
     do_syscall_x64 arch/x86/ent...
    9d6d7f1c
scm.c 3.68 KB