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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ec6aba6-fb27-0982-8874-891528c9535c@canonical.com>
Date:   Fri, 16 Feb 2018 15:26:20 +0000
From:   Colin Ian King <colin.king@...onical.com>
To:     Alexandre Belloni <alexandre.belloni@...e-electrons.com>
Cc:     Alessandro Zummo <a.zummo@...ertech.it>, linux-rtc@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][V2] rtc: tx4939: avoid unintended sign extension on a 24
 bit shift

On 16/02/18 15:24, Alexandre Belloni wrote:
> On 15/02/2018 at 21:44:53 +0100, Alexandre Belloni wrote:
>> On 15/02/2018 at 19:36:14 +0000, Colin King wrote:
>>> From: Colin Ian King <colin.king@...onical.com>
>>>
>>> The shifting of buf[5] by 24 bits to the left will be promoted to
>>> a 32 bit signed int and then sign-extended to an unsigned long. If
>>> the top bit of buf[5] is set then all then all the upper bits sec
>>> end up as also being set because of the sign-extension. Fix this by
>>> casting buf[5] to an unsigned long before the shift.
>>>
>>
>> The timing of the discovery of this issue is suspicious. I believe it is
>> because I just enabled COMPILE_TEST on that driver and now this gets
>> compiled on a 64bit architecture.
>>
>> Can I ask on which architecture this is an issue? I don't think (and a
>> small test program confirms) x86 does the sign extension because both
>> sec and buf are unsigned.
>>
> 
> Actually, my test program was wrong and you are right.
> Kudos to CoverityScan static analysis for finding it. It's not obvious
for sure

Colin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ