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: Fri, 9 Feb 2024 15:20:40 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] regmap: kunit: Ensure that changed bytes are actually
 different

On 2/9/24 14:39, Mark Brown wrote:
> On Fri, Feb 09, 2024 at 02:07:38PM -0800, Guenter Roeck wrote:
> 
>> This is actually worse than v1 because hw_buf[6] isn't used anywhere.
>> Making sure that the values in the val[] array don't match the values
>> in hw_buf[6..7] doesn't add any value.
> 
> Yeah, I realised after reading your earlier mail.  It's passing for me
> somehow.
> 

It is passing because the probability for it to fail is really low.
It only fails reliably with the cheat below.

>> FWIW, I had struggled with the re-use of val[0] for two different tests
>> (on hw_buf[2] and hw_buf[4]) myself. The only solution other than making sure
>> that it neither matches hw_buf[2] nor hw_buf[4] I came up with was to use a
>> separate variable for the accesses to hw_buf[4] (or hw_buf[6] in the old code).
> Indeed, it was fine with the old code due to not caring about having
> different values but we need to generate three values now.
> 
>>          get_changed_bytes(&hw_buf[6], &val[0], sizeof(val));
>> +       // Let's cheat.
>> +       // Remember, the above code doesn't look into hw_buf[2..5],
>> +       // so anything might be in there, including the values from
>> +       // the val[] array.
>> +       hw_buf[2] = val[0];
>> +       hw_buf[3] = val[1];
>> +       hw_buf[4] = val[0];
>> +       hw_buf[5] = val[1];
> 
> I don't understand how this interacts with the pre-sync check?

That is because the test expects the memory in hw_buf[] and val[] to be
different (because hw_buf[] wasn't updated to the new values). The above
cheat forces hw_buf[2,3] and val[0,1] to be the same, so the pre-sync test
fails. The post-sync test passes because the values are expected to be
the same at that time.

Guenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ