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-prev] [day] [month] [year] [list]
Message-ID: <CANn89iLdP+FFb7+TR-RHW1Kdm5XAoP1_4ypYp+Cm5wzPbx-K1w@mail.gmail.com>
Date:   Thu, 15 Apr 2021 17:53:20 +0200
From:   Eric Dumazet <edumazet@...gle.com>
To:     "Gong, Sishuai" <sishuai@...due.edu>
Cc:     "davem@...emloft.net" <davem@...emloft.net>,
        "yoshfuji@...ux-ipv6.org" <yoshfuji@...ux-ipv6.org>,
        "dsahern@...nel.org" <dsahern@...nel.org>,
        "kuba@...nel.org" <kuba@...nel.org>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PROBLEM] a data race between tcp_set_default_congestion_control()
 and tcp_set_congestion_control()

On Thu, Apr 15, 2021 at 5:47 PM Gong, Sishuai <sishuai@...due.edu> wrote:
>
> Hi,
>
> We found a data race between tcp_set_default_congestion_control() and tcp_set_congestion_control() in linux-5.12-rc3.
> In general, when tcp_set_congestion_control() is reading ca->flags with a lock grabbed, tcp_set_default_congestion_control()
> may be updating ca->flags at the same time, as shown below.
>
> When the writer and reader are running parallel, tcp_set_congestion_control()’s control flow
> might be non-deterministic, either returning a -EPERM or calling tcp_reinit_congestion_control().
>
> We also notice in tcp_set_allowed_congestion_control(), the write to ca->flags is protected by tcp_cong_list_lock,
> so we want to point it out in case the data race is unexpected.
>
> Thread 1                                                        Thread 2
> //tcp_set_default_congestion_control()  //tcp_set_congestion_control()
>                                                                 // lock_sock() grabbed
>                                                                 if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin))
>                                                                         err = -EPERM;
>                                                                 else if (!bpf_try_module_get(ca, ca->owner))
>                                                                         err = -EBUSY;
>                                                                 else
>                                                                         tcp_reinit_congestion_control(sk, ca);
> ca->flags |= TCP_CONG_NON_RESTRICTED;
>
>
>
> Thanks,
> Sishuai
>

Yes, obviously reading ca->flags while another thread might set the bit is racy.

This is of no consequence, if you want to silence KCSAN please a patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ