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]
Message-Id: <FF37A337-32B0-4951-B13F-2EFB1734B6DE@toblux.com>
Date: Sat, 14 Sep 2024 02:23:17 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: kees@...nel.org,
 gustavoars@...nel.org,
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 mcgrof@...nel.org,
 linux-hardening@...r.kernel.org,
 linux-kernel@...r.kernel.org,
 Bill Wendling <morbo@...gle.com>
Subject: Re: [RESEND PATCH v2] params: Annotate struct module_param_attrs with
 __counted_by()

On 14. Sep 2024, at 01:44, Nathan Chancellor <nathan@...nel.org> wrote:
> On Sat, Sep 14, 2024 at 01:32:19AM +0200, Thorsten Blum wrote:
>> Thanks for reporting this.
>> 
>> Changing
>> 
>> memset(&mk->mp->attrs[mk->mp->num - 1], 0, sizeof(mk->mp->attrs[0]));
>> 
>> to
>> 
>> memset(mk->mp->attrs + mk->mp->num - 1, 0, sizeof(mk->mp->attrs[0]));
>> 
>> fixes the false-positive warning
>> 
>> memset: detected buffer overflow: 32 byte write of buffer size 0
>> 
>> even though the pointers have the same value. Does anyone know why?
> 
> Might be a good question for Bill? The full context is available
> starting at:
> 
> https://lore.kernel.org/all/20240913164630.GA4091534@thelio-3990X/
> 
> I wonder if the krealloc() has something to do with it? I should try GCC
> but I don't have a tip of tree copy handy at the moment and I am also
> rushing at the end of my day to pack for my travels to LPC :)

I think the problem is with __builtin_dynamic_object_size().

memset(p,,) calls __struct_size(p), which calls
__builtin_dynamic_object_size(p, 0) and this behaves weirdly:

 __builtin_dynamic_object_size(&mk->mp->attrs[mk->mp->num - 1], 0);

evaluates to 0, but

 __builtin_dynamic_object_size(mk->mp->attrs + mk->mp->num - 1, 0);

evaluates to 4294967295.

Both values are wrong, but the latter doesn't trigger the
false-positive warning.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ