[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200615180753.GJ4151@kadam>
Date: Mon, 15 Jun 2020 21:07:53 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Waiman Long <longman@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
David Howells <dhowells@...hat.com>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Joe Perches <joe@...ches.com>,
Matthew Wilcox <willy@...radead.org>,
David Rientjes <rientjes@...gle.com>,
samba-technical@...ts.samba.org,
virtualization@...ts.linux-foundation.org, linux-mm@...ck.org,
linux-sctp@...r.kernel.org, target-devel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
devel@...verdev.osuosl.org, linux-s390@...r.kernel.org,
linux-scsi@...r.kernel.org, x86@...nel.org,
kasan-dev@...glegroups.com, cocci@...teme.lip6.fr,
linux-wpan@...r.kernel.org, intel-wired-lan@...ts.osuosl.org,
linux-crypto@...r.kernel.org, linux-pm@...r.kernel.org,
ecryptfs@...r.kernel.org, linux-nfs@...r.kernel.org,
linux-fscrypt@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-cifs@...r.kernel.org,
netdev@...r.kernel.org, linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-bluetooth@...r.kernel.org,
linux-security-module@...r.kernel.org, keyrings@...r.kernel.org,
tipc-discussion@...ts.sourceforge.net, wireguard@...ts.zx2c4.com,
linux-ppp@...r.kernel.org, linux-integrity@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-btrfs@...r.kernel.org
Subject: Re: [PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive()
On Mon, Apr 13, 2020 at 05:15:49PM -0400, Waiman Long wrote:
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 23c7500eea7d..c08bc7eb20bd 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -1707,17 +1707,17 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
> EXPORT_SYMBOL(krealloc);
>
> /**
> - * kzfree - like kfree but zero memory
> + * kfree_sensitive - Clear sensitive information in memory before freeing
> * @p: object to free memory of
> *
> * The memory of the object @p points to is zeroed before freed.
> - * If @p is %NULL, kzfree() does nothing.
> + * If @p is %NULL, kfree_sensitive() does nothing.
> *
> * Note: this function zeroes the whole allocated buffer which can be a good
> * deal bigger than the requested buffer size passed to kmalloc(). So be
> * careful when using this function in performance sensitive code.
> */
> -void kzfree(const void *p)
> +void kfree_sensitive(const void *p)
> {
> size_t ks;
> void *mem = (void *)p;
> @@ -1725,10 +1725,10 @@ void kzfree(const void *p)
> if (unlikely(ZERO_OR_NULL_PTR(mem)))
> return;
> ks = ksize(mem);
> - memset(mem, 0, ks);
> + memzero_explicit(mem, ks);
^^^^^^^^^^^^^^^^^^^^^^^^^
This is an unrelated bug fix. It really needs to be pulled into a
separate patch by itself and back ported to stable kernels.
> kfree(mem);
> }
> -EXPORT_SYMBOL(kzfree);
> +EXPORT_SYMBOL(kfree_sensitive);
>
> /**
> * ksize - get the actual amount of memory allocated for a given object
regards,
dan carpenter
Powered by blists - more mailing lists