[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <803557cc672ef0bcd9565c7d5d78e7053388f5d7.camel@perches.com>
Date: Sun, 14 Jun 2020 13:01:51 -0700
From: Joe Perches <joe@...ches.com>
To: efremov@...ux.com, Julia Lawall <Julia.Lawall@...6.fr>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: cocci@...teme.lip6.fr, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] coccinelle: api: add kzfree script
On Sun, 2020-06-14 at 22:42 +0300, Denis Efremov wrote:
> On 6/4/20 7:27 PM, Joe Perches wrote:
> > On Thu, 2020-06-04 at 17:08 +0300, Denis Efremov wrote:
> > > Check for memset() with 0 followed by kfree().
> >
> > Perhaps those uses should be memzero_explicit or kvfree_sensitive.
> >
> Is it safe to suggest to use kzfree instead of memzero_explicit && kfree?
> Or it would be better to use kvfree_sensitive in this case.
> kzfree uses memset(0) with no barrier_data.
>
> For example:
> diff -u -p a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
[]
> @@ -1081,8 +1081,7 @@ static int safexcel_hmac_init_pad(struct
> }
>
> /* Avoid leaking */
> - memzero_explicit(keydup, keylen);
> - kfree(keydup);
> + kzfree(keydup);
It would be better to use kvfree_sensitive()
Powered by blists - more mailing lists