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:   Thu, 15 Apr 2021 15:47:21 +0000
From:   "Gong, Sishuai" <sishuai@...due.edu>
To:     "edumazet@...gle.com" <edumazet@...gle.com>,
        "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>
CC:     Linux Kernel Network Developers <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PROBLEM] a data race between tcp_set_default_congestion_control()
 and tcp_set_congestion_control()

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ