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]
Message-ID: <20230704060734.GA38702@ubuntu>
Date: Mon, 3 Jul 2023 23:07:34 -0700
From: Hyunwoo Kim <v4bel@...ori.io>
To: sam@...dozajonas.com
Cc: davem@...emloft.net, pabeni@...hat.com, kuba@...nel.org,
	netdev@...r.kernel.org, imv4bel@...il.com, v4bel@...ori.io
Subject: [report?] A race condition is suspected.

Dear all,

>From the code, it looks like a use-after-free due to a race condition 
could be caused by the lack of a proper lock between the ncsi_dev_work() 
worker and the vlan ioctl:
```
                  cpu0                                          cpu1

         ncsi_dev_work()
           ncsi_configure_channel()
             set_one_vid()
               rcu_read_lock()
                                                            sock_ioctl()
                                                              vlan_ioctl_handler()
                                                                unregister_vlan_dev()
                                                                  vlan_vid_del()
                                                                    __vlan_vid_del()
                                                                      vlan_kill_rx_filter_info()
                                                                        ncsi_vlan_rx_kill_vid()
                                                                          list_del_rcu(&vlan->list);
                                                                          kfree(vlan);
               vid = vlan->vid;    // use-after-free?
               rcu_read_unlock()
```

However, I do not have a device that uses the ncsi_dev_work() worker, 
so I have not been able to debug this.

Can a race condition like this actually happen, and if so, it seems 
like we need to change `kfree(vlan);` to `kfree_rcu(vlan)`, or add 
an appropriate lock to the worker.


Regards,
Hyunwoo Kim

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ