[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1599836664.4041.21.camel@HansenPartnership.com>
Date: Fri, 11 Sep 2020 08:04:24 -0700
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Alex Dewar <alex.dewar90@...il.com>
Cc: David Howells <dhowells@...hat.com>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>, keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] security: keys: Use kvfree_sensitive in a few places
On Fri, 2020-09-11 at 12:44 +0100, Alex Dewar wrote:
> In big_key.c, there are a few places where memzero_explicit + kvfree
> is used. It is better to use kvfree_sensitive instead, which is more
> readable and also prevents the compiler from eliding the call to
> memzero_explicit. Fix this.
That last bit is untrue: the compiler can't elide memzero_explicit ...
that's why it has the explicit suffix.
The original problem was a lot of people do memset(.., 0, ..); kfree()
which the compiler can elide if it understands the memory is going out
of scope. Or the even more problematic memset(..., 0, ...) on a stack
variable before it goes out of scope.
We can argue about readability but there's no secret leak here.
James
Powered by blists - more mailing lists