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, 27 Feb 2024 12:12:57 +0100
From: Arend van Spriel <arend.vanspriel@...adcom.com>
To: Kalle Valo <kvalo@...nel.org>, "Gustavo A. R. Silva"
 <gustavoars@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>, linux-wireless@...r.kernel.org,
 brcm80211@...ts.linux.dev, brcm80211-dev-list.pdl@...adcom.com,
 linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] wifi: brcmfmac: fweh: Fix boot crash on Raspberry
 Pi 4

On 2/27/2024 10:19 AM, Kalle Valo wrote:
> "Gustavo A. R. Silva" <gustavoars@...nel.org> wrote:
> 
>> Fix boot crash on Raspberry Pi by moving the update to `event->datalen`
>> before data is copied into flexible-array member `data` via `memcpy()`.
>>
>> Flexible-array member `data` was annotated with `__counted_by(datalen)`
>> in commit 62d19b358088 ("wifi: brcmfmac: fweh: Add __counted_by for
>> struct brcmf_fweh_queue_item and use struct_size()"). The intention of
>> this is to gain visibility into the size of `data` at run-time through
>> its _counter_ (in this case `datalen`), and with this have its accesses
>> bounds-checked at run-time via CONFIG_FORTIFY_SOURCE and
>> CONFIG_UBSAN_BOUNDS.
>>
>> To effectively accomplish the above, we shall update the counter
>> (`datalen`), before the first access to the flexible array (`data`),
>> which was also done in the mentioned commit.
>>
>> However, commit edec42821911 ("wifi: brcmfmac: allow per-vendor event
>> handling") inadvertently caused a buffer overflow, detected by
>> FORTIFY_SOURCE. It moved the `event->datalen = datalen;` update to after
>> the first `data` access, at which point `event->datalen` was not yet
>> updated from zero (after calling `kzalloc()`), leading to the overflow
>> issue.
>>
>> This fix repositions the `event->datalen = datalen;` update before
>> accessing `data`, restoring the intended buffer overflow protection. :)
>>
>> Fixes: edec42821911 ("wifi: brcmfmac: allow per-vendor event handling")
>> Reported-by: Nathan Chancellor <nathan@...nel.org>
>> Closes: https://gist.github.com/nathanchance/e22f681f3bfc467f15cdf6605021aaa6
>> Tested-by: Nathan Chancellor <nathan@...nel.org>
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
>> Reviewed-by: Kees Cook <keescook@...omium.org>
> 
> Arend, ack?

Figured Kees Cook was the trumping authority here, but here it is:

Acked-by: Arend van Spriel <arend.vanspriel@...adcom.com>

Gr. AvS

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4219 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ