[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c44df8c581014158b7b2753f446ea27741f40c94.camel@perches.com>
Date: Thu, 14 May 2020 05:08:52 -0700
From: Joe Perches <joe@...ches.com>
To: Matthew Wilcox <willy@...radead.org>,
Balbir Singh <bsingharora@...il.com>
Cc: Waiman Long <longman@...hat.com>,
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>, linux-mm@...ck.org,
keyrings@...r.kernel.org, linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH v3] mm: Add kvfree_sensitive() for freeing sensitive
data objects
On Thu, 2020-05-14 at 05:00 -0700, Matthew Wilcox wrote:
> On Thu, May 14, 2020 at 09:00:40PM +1000, Balbir Singh wrote:
> > I wonder if the right thing to do is also to disable pre-emption, just so that the thread does not linger on with sensitive data.
> >
> > void kvfree_sensitive(const void *addr, size_t len)
> > {
> > preempt_disable();
> > if (likely(!ZERO_OR_NULL_PTR(addr))) {
> > memzero_explicit((void *)addr, len);
> > kvfree(addr);
> > }
> > preempt_enable();
> > }
> > EXPORT_SYMBOL(kvfree_sensitive);
>
> If it's _that_ sensitive then the caller should have disabled preemption.
> Because preemption could otherwise have occurred immediately before
> kvfree_sensitive() was called.
static inline ?
Powered by blists - more mailing lists