From: Jarkko Sakkinen Date: Wed, 08 Apr 2020 13:38:35 +0000 Subject: Re: [PATCH v3] mm: Add kvfree_sensitive() for freeing sensitive data objects Message-Id: <20200408133835.GA4097@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit List-Id: References: <20200407200318.11711-1-longman@redhat.com> In-Reply-To: <20200407200318.11711-1-longman@redhat.com> To: Waiman Long Cc: Andrew Morton , David Howells , James Morris , "Serge E. Hallyn" , linux-mm@kvack.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Joe Perches , Matthew Wilcox , David Rientjes On Tue, Apr 07, 2020 at 04:03:18PM -0400, Waiman Long wrote: > For kvmalloc'ed data object that contains sensitive information like > cryptographic key, we need to make sure that the buffer is always > cleared before freeing it. Using memset() alone for buffer clearing may > not provide certainty as the compiler may compile it away. To be sure, > the special memzero_explicit() has to be used. > > This patch introduces a new kvfree_sensitive() for freeing those > sensitive data objects allocated by kvmalloc(). The relevnat places > where kvfree_sensitive() can be used are modified to use it. > > Fixes: 4f0882491a14 ("KEYS: Avoid false positive ENOMEM error on key read") > Suggested-by: Linus Torvalds > Signed-off-by: Waiman Long Acked-by: Jarkko Sakkinen David, you want to pick this one? /Jarkko