lkml.org 
[lkml]   [2020]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] mm: Add kvfree_sensitive() for freeing sensitive data objects
On Tue, Apr 07, 2020 at 04:45:45PM -0400, Waiman Long wrote:
> On 4/7/20 4:31 PM, Joe Perches wrote:
> > On Tue, 2020-04-07 at 16:03 -0400, Waiman Long wrote:
> >> +extern void kvfree_sensitive(const void *addr, size_t len);
> > Why should size_t len be required?
> >
> > Why not do what kzfree does and memset
> > the entire allocation? (area->size)
>
> If the memory is really virtually mapped, the only way to find out the
> size of the object is to use find_vm_area() which can be relatively high
> cost and no simple helper function is available. On the other hand, the
> length is readily available in the callers. So passing the length
> directly to the kvfree_sensitive is simpler.

Also it lets us zero only the first N bytes of the allocation. That might
be good for performance, if only the first N bytes of an M byte allocation
are actually sensitive. I don't know if we have any such cases, but
they could exist.

\
 
 \ /
  Last update: 2020-04-08 00:13    [W:0.057 / U:5.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site