Re: [PATCH] ACPICA: fix UBSAN warning using __builtin_offsetof

From
Nick Desaulniers <ndesaulniers@google.com>
Date
2020-06-01 23:48:44
Also in
linux-acpi, lkml, stable
Reply to
Peter Collingbourne, 2020-06-01
On Mon, Jun 1, 2020 at 4:37 PM Peter Collingbourne [off-list ref] wrote:
On Mon, Jun 1, 2020 at 4:18 PM Nick Desaulniers [off-list ref] wrote:
quoted
Will reported UBSAN warnings:
UBSAN: null-ptr-deref in drivers/acpi/acpica/tbfadt.c:459:37
UBSAN: null-ptr-deref in arch/arm64/kernel/smp.c:596:6

Looks like the emulated offsetof macro ACPI_OFFSET is causing these. We
can avoid this by using the compiler builtin, __builtin_offsetof.
Would it be better to s/ACPI_OFFSET/offsetof/g the existing users of
this macro and remove it? It looks like offsetof is already being used
pervasively in the kernel, and its definition comes from
<linux/stddef.h>.
I count only 9 uses in the tree, so not too bad a yak shave. Good
idea; I'll send tomorrow short of any other feedback.  I still think
we want the builtin, since we don't want to include stddef.h in the
kernel, I think.
-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (30 messages) 30 messages, 9 authors, last reply 2020-06-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help