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]
Message-ID: <20221123184738.29718806@kernel.org>
Date:   Wed, 23 Nov 2022 18:47:38 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     Leon Romanovsky <leon@...nel.org>, <netdev@...r.kernel.org>,
        <jiri@...dia.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
        <pabeni@...hat.com>
Subject: Re: [PATCH net] net: devlink: fix UAF in
 devlink_compat_running_version()

On Wed, 23 Nov 2022 14:40:24 +0800 Yang Yingliang wrote:
> > +err_dl_unregister:
> > +	devl_unregister(devlink);  
> It races with dev_ethtool():
> dev_ethtool
>    devlink_try_get()
>                                  nsim_drv_probe
>                                  devl_lock()
>      devl_lock()
>                                  devlink_unregister()
>                                    devlink_put()
>                                    wait_for_completion() <- the refcount 
> is got in dev_ethtool, it causes ABBA deadlock

Yeah.. so my original design for the locking had a "devlink_is_alive()"
check for this exact reason:

https://lore.kernel.org/netdev/20211030231254.2477599-3-kuba@kernel.org/

and the devlink structure was properly refcounted (devlink_put() calls
devlink_free() when the last reference is released).

Pure references then need to check if the instance is still alive
after locking it. Which is fine, it should only happen in core code.

I think we should go back to that idea.

The waiting for references is a nightmare in the netdev code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ