lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Apr 2023 14:24:40 -0700
From:   Luiz Augusto von Dentz <luiz.dentz@...il.com>
To:     Li Tuo <islituo@...il.com>
Cc:     marcel@...tmann.org, johan.hedberg@...il.com,
        "David S. Miller" <davem@...emloft.net>, edumazet@...gle.com,
        Jakub Kicinski <kuba@...nel.org>, pabeni@...hat.com,
        linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org,
        Linux Kernel <linux-kernel@...r.kernel.org>,
        baijiaju1990@...look.com
Subject: Re: [BUG][RESEND] Bluetooth: L2CAP: possible data race in __sco_sock_close()

Hi,

On Fri, Apr 28, 2023 at 3:27 AM Li Tuo <islituo@...il.com> wrote:
>
>   Hello,
>
> Our static analysis tool finds a possible data race in the l2cap protocol
> in Linux 6.3.0-rc7:
>
> In most calling contexts, the variable sk->sk_socket is accessed
> with holding the lock sk->sk_callback_lock. Here is an example:
>
>   l2cap_sock_accept() --> Line 346 in net/bluetooth/l2cap_sock.c
>       bt_accept_dequeue() --> Line 368 in net/bluetooth/l2cap_sock.c
>           sock_graft() --> Line 240 in net/bluetooth/af_bluetooth.c
>               write_lock_bh(&sk->sk_callback_lock); --> Line 2081 in include/net/sock.h (Lock sk->sk_callback_lock)
>               sk_set_socket() --> Line 2084 in include/net/sock.h
>                   sk->sk_socket = sock; --> Line 2054 in include/net/sock.h (Access sk->sk_socket)
>
> However, in the following calling context:
>
>   sco_sock_shutdown() --> Line 1227 in net/bluetooth/sco.c
>       __sco_sock_close() --> Line 1243 in net/bluetooth/sco.c
>           BT_DBG(..., sk->sk_socket); --> Line 431 in net/bluetooth/sco.c (Access sk->sk_socket)
>
> the variable sk->sk_socket is accessed without holding the lock
> sk->sk_callback_lock, and thus a data race may occur.
>
> Reported-by: BassCheck <bass@...a.edu.cn>

Need to check in detail what it means to hold the sk_callback_lock,
btw is this static analysis tool of yours something public that we can
use in our CI to detect these problems?


-- 
Luiz Augusto von Dentz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ