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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 1 Feb 2021 19:40:14 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     netdev@...r.kernel.org, Cong Wang <cong.wang@...edance.com>,
        "Gong, Sishuai" <sishuai@...due.edu>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [Patch net-next v2] net: fix dev_ifsioc_locked() race condition

On Sat, 30 Jan 2021 18:27:55 -0800 Cong Wang wrote:
> From: Cong Wang <cong.wang@...edance.com>
> 
> dev_ifsioc_locked() is called with only RCU read lock, so when
> there is a parallel writer changing the mac address, it could
> get a partially updated mac address, as shown below:
> 
> Thread 1			Thread 2
> // eth_commit_mac_addr_change()
> memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> 				// dev_ifsioc_locked()
> 				memcpy(ifr->ifr_hwaddr.sa_data,
> 					dev->dev_addr,...);
> 
> Close this race condition by guarding them with a RW semaphore,
> like netdev_get_name(). The writers take RTNL anyway, so this
> will not affect the slow path. To avoid bothering existing
> dev_set_mac_address() callers in drivers, introduce a new wrapper
> just for user-facing callers in ioctl and rtnetlink.

Some of the drivers need to be update, tho, right? At a quick look at
least bond and tun seem to be making calls to dev_set_mac_address() 
on IOCTL paths.

> Fixes: 3710becf8a58 ("net: RCU locking for simple ioctl()")
> Reported-by: "Gong, Sishuai" <sishuai@...due.edu>
> Cc: Eric Dumazet <eric.dumazet@...il.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Signed-off-by: Cong Wang <cong.wang@...edance.com>
> ---
>  include/linux/netdevice.h |  3 +++
>  net/core/dev.c            | 40 +++++++++++++++++++++++++++++++++++++++
>  net/core/dev_ioctl.c      | 20 +++++++-------------
>  net/core/rtnetlink.c      |  2 +-
>  4 files changed, 51 insertions(+), 14 deletions(-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ