Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-29 Thread Cong Wang
On Fri, Jan 29, 2021 at 10:00 AM Jakub Kicinski wrote: > > On Thu, 28 Jan 2021 21:47:04 -0800 Cong Wang wrote: > > On Thu, Jan 28, 2021 at 9:21 PM Jakub Kicinski wrote: > > > On Thu, 28 Jan 2021 21:08:05 -0800 Cong Wang wrote: > > > > On Thu, Jan 28, 2021 at 12:55 PM Jakub Kicinski wrote: > > >

Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-29 Thread Jakub Kicinski
On Thu, 28 Jan 2021 21:47:04 -0800 Cong Wang wrote: > On Thu, Jan 28, 2021 at 9:21 PM Jakub Kicinski wrote: > > On Thu, 28 Jan 2021 21:08:05 -0800 Cong Wang wrote: > > > On Thu, Jan 28, 2021 at 12:55 PM Jakub Kicinski wrote: > > > > > > > > On Sat, 23 Jan 2021 17:30:49 -0800 Cong Wang wrote:

Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-28 Thread Cong Wang
On Thu, Jan 28, 2021 at 9:21 PM Jakub Kicinski wrote: > > On Thu, 28 Jan 2021 21:08:05 -0800 Cong Wang wrote: > > On Thu, Jan 28, 2021 at 12:55 PM Jakub Kicinski wrote: > > > > > > On Sat, 23 Jan 2021 17:30:49 -0800 Cong Wang wrote: > > > > From: Cong Wang > > > > > > > > dev_ifsioc_locked() is

Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-28 Thread Jakub Kicinski
On Thu, 28 Jan 2021 21:08:05 -0800 Cong Wang wrote: > On Thu, Jan 28, 2021 at 12:55 PM Jakub Kicinski wrote: > > > > On Sat, 23 Jan 2021 17:30:49 -0800 Cong Wang wrote: > > > From: Cong Wang > > > > > > dev_ifsioc_locked() is called with only RCU read lock, so when > > > there is a parallel wri

Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-28 Thread Cong Wang
On Thu, Jan 28, 2021 at 12:55 PM Jakub Kicinski wrote: > > On Sat, 23 Jan 2021 17:30:49 -0800 Cong Wang wrote: > > From: Cong Wang > > > > 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 m

Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-28 Thread Jakub Kicinski
On Sat, 23 Jan 2021 17:30:49 -0800 Cong Wang wrote: > From: Cong Wang > > 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

Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-27 Thread Cong Wang
On Mon, Jan 25, 2021 at 11:43 AM Gong, Sishuai wrote: > > Hi, > > We also found another pair of writer and reader that may suffer the same > problem. > > A data race may also happen on the variable netdev->dev_addr when functions > e1000_set_mac() and packet_getname() run in parallel, eventually

Re: [Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-25 Thread Gong, Sishuai
Hi, We also found another pair of writer and reader that may suffer the same problem. A data race may also happen on the variable netdev->dev_addr when functions e1000_set_mac() and packet_getname() run in parallel, eventually it could return a partially updated MAC address to the user, as sho

[Patch net] net: fix dev_ifsioc_locked() race condition

2021-01-23 Thread Cong Wang
From: Cong Wang 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 1Thread 2 // eth_commit_mac_addr_change() memcpy(dev->dev_addr, addr->s