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: <ZLj5HPT2y8cRhWnC@duo.ucw.cz>
Date:   Thu, 20 Jul 2023 11:06:36 +0200
From:   Pavel Machek <pavel@....cz>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     王明-软件底层技术部 
        <machel@...o.com>, Ajay Singh <ajay.kathat@...rochip.com>,
        Claudiu Beznea <claudiu.beznea@...rochip.com>,
        Kalle Valo <kvalo@...nel.org>,
        "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "opensource.kernel" <opensource.kernel@...o.com>
Subject: Re: [PATCH net v2] net: wireless: Use kfree_sensitive instead of
 kfree

Hi!

> > diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
> > index b545d93c6e37..45bcadeba2da 100644
> > --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
> > +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
> > @@ -518,7 +518,7 @@ static int wilc_wfi_cfg_allocate_wpa_igtk_entry(struct wilc_priv *priv, u8 idx)
> >  static int wilc_wfi_cfg_copy_wpa_info(struct wilc_wfi_key *key_info,
> >  				      struct key_params *params)
> >  {
> > -	kfree(key_info->key);
> > +	kfree_sensitive(key_info->key);
> >  
> >  	key_info->key = kmemdup(params->key, params->key_len, GFP_KERNEL);
> >  	if (!key_info->key)
> > @@ -656,7 +656,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, int link_id,
> >  	if (!pairwise && (key_index == 4 || key_index == 5)) {
> >  		key_index -= 4;
> >  		if (priv->wilc_igtk[key_index]) {
> > -			kfree(priv->wilc_igtk[key_index]->key);
> > +			kfree_sensitive(priv->wilc_igtk[key_index]->key);
> 
> Normally "kfree_sensitive()" is used at the end of a function for when
> kfree() of a local variable might not be called because the compiler
> thinks it is smarter than us and optimizes it away.
> 
> Putting it here, in the normal operation, really doesn't do anything,
> right?  There's always going to be odd data in the heap and normal

It does memzero.

https://elixir.bootlin.com/linux/latest/source/mm/slab_common.c#L1411
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ