lists.openwall.net   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  linux-cve-announce  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, 31 Jul 2018 21:22:23 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Jason Gunthorpe <jgg@...pe.ca>
Cc:     Rasmus Villemoes <linux@...musvillemoes.dk>,
        Leon Romanovsky <leonro@...lanox.com>,
        Leon Romanovsky <leon@...nel.org>,
        Bart Van Assche <Bart.VanAssche@....com>,
        Doug Ledford <dledford@...hat.com>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        linux-rdma <linux-rdma@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/3] overflow.h: Add arithmetic shift helper

On Tue, Jul 31, 2018 at 7:15 PM, Jason Gunthorpe <jgg@...pe.ca> wrote:
> On Tue, Jul 31, 2018 at 05:00:37PM -0700, Kees Cook wrote:
>> From: Jason Gunthorpe <jgg@...lanox.com>
>>
>> Add shift_overflow() helper to assist driver authors in ensuring that
>> shift operations don't cause overflows or other odd conditions.
>>
>> Signed-off-by: Jason Gunthorpe <jgg@...lanox.com>
>> Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
>> [kees: tweaked comments and commit log, dropped unneeded assignment]
>> Signed-off-by: Kees Cook <keescook@...omium.org>
>> ---
>>  include/linux/overflow.h | 31 +++++++++++++++++++++++++++++++
>>  1 file changed, 31 insertions(+)
>>
>> diff --git a/include/linux/overflow.h b/include/linux/overflow.h
>> index 8712ff70995f..69fc366ce865 100644
>> --- a/include/linux/overflow.h
>> +++ b/include/linux/overflow.h
>> @@ -202,6 +202,37 @@
>>
>>  #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
>>
>> +/** check_shift_overflow() - Calculate a left-shifted value and check overflow
>> + *
>> + * @a: Value to be shifted
>> + * @b: How many bits left to shift
>
> The above @b should be @s

Ooops, copy-paste-o. :)

>
>> +#define check_shift_overflow(a, s, d) ({                             \
>
> Should I run this series through the rdma tree?

I'd like to get Rasmus's Ack, but otherwise, yes, that'd be fine.

-Kees

-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ