lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 May 2020 21:29:58 -0400
From:   Waiman Long <>
To:     Andrew Morton <>,
        David Howells <>
Cc:     Jarkko Sakkinen <>,
        James Morris <>,
        "Serge E. Hallyn" <>,,,,
        Linus Torvalds <>,
        Joe Perches <>,
        Matthew Wilcox <>,
        David Rientjes <>
Subject: Re: [PATCH v3] mm: Add kvfree_sensitive() for freeing sensitive data

On 5/5/20 4:35 PM, Andrew Morton wrote:
> On Tue, 07 Apr 2020 21:21:57 +0100 David Howells <> wrote:
>> David Howells <> wrote:
>>>>   			if (unlikely(key_data))
>>>> -				__kvzfree(key_data, key_data_len);
>>>> +				kvfree_sensitive(key_data, key_data_len);
>>> I think the if-statement is redundant.
>> Ah - I see that you explicitly wanted to keep it.
> Why's that?

There is a comment above it:

                  * The key may change (unlikely) in between 2 consecutive
                  * __keyctl_read_key() calls. In this case, we reallocate
                  * a larger buffer and redo the key read when
                  * key_data_len < ret <= buflen.
                 if (ret > key_data_len) {
                         if (unlikely(key_data))
                                 __kvzfree(key_data, key_data_len);

key_data will be defined only if the unlikely case that the key increase 
in length between the 2 consecutive __keyctl_read_key() call and we have 
to enlarge the buffer and read the key again. I want to keep the 
unlikely() macro to emphasize the fact that this condition should not 

>> There's a good chance it'll get janitored at some point.
> Indeed.  Perhaps add a few little comments to explain the reasoning and
> to keep the janitorial fingers away?
I can reword the comment to make it more explicit and send a v4 if you 
think the current comment is not clear enough.


Powered by blists - more mailing lists