[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa6260781d8a87ea04ac2014ddabaf7066fcdcec.camel@perches.com>
Date: Mon, 06 Apr 2020 11:46:26 -0700
From: Joe Perches <joe@...ches.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Waiman Long <longman@...hat.com>
Cc: David Howells <dhowells@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Linux-MM <linux-mm@...ck.org>, keyrings@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: Add kvfree_sensitive() for freeing sensitive data
objects
On Mon, 2020-04-06 at 11:06 -0700, Linus Torvalds wrote:
> On Mon, Apr 6, 2020 at 10:59 AM Waiman Long <longman@...hat.com> wrote:
> > I have actually been thinking about that. I saw a couple of cases in the
> > crypto code where a memzero_explicit() is followed by kfree(). Those can
> > be replaced by kfree_sensitive.
>
> Ack.
>
> Doing that (and renaming kvzfree) should be a fairly straightforward
> coccinelle patch.
Not really as comment and prototype and existing cocci
scripts that contain kzfree are difficult to change.
A sed is straightforward and works well.
$ git grep -w --name-only kzfree | \
xargs sed -i 's/\bkzfree\b/kfree_sensitive/'
For today's next that's:
$ git diff --shortstat
116 files changed, 322 insertions(+), 322 deletions(-)
After this change:
The kernel-doc comment in slab_common.c should be
edited from zeroed to something else.
* kfree_sensitive - like kfree but zero memory
* @p: object to free memory of
*
* The memory of the object @p points to is zeroed before freed.
* 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.
*/
Powered by blists - more mailing lists