linux/include
Gustavo A. R. Silva 45b3fae467 neighbour: Fix __randomize_layout crash in struct neighbour
Previously, one-element and zero-length arrays were treated as true
flexible arrays, even though they are actually "fake" flex arrays.
The __randomize_layout would leave them untouched at the end of the
struct, similarly to proper C99 flex-array members.

However, this approach changed with commit 1ee60356c2 ("gcc-plugins:
randstruct: Only warn about true flexible arrays"). Now, only C99
flexible-array members will remain untouched at the end of the struct,
while one-element and zero-length arrays will be subject to randomization.

Fix a `__randomize_layout` crash in `struct neighbour` by transforming
zero-length array `primary_key` into a proper C99 flexible-array member.

Fixes: 1ee60356c2 ("gcc-plugins: randstruct: Only warn about true flexible arrays")
Closes: https://lore.kernel.org/linux-hardening/20231124102458.GB1503258@e124191.cambridge.arm.com/
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Joey Gouly <joey.gouly@arm.com>
Link: https://lore.kernel.org/r/ZWJoRsJGnCPdJ3+2@work
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-11-28 12:18:29 +01:00
..
acpi
asm-generic asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation 2023-11-22 09:32:49 -08:00
clocksource
crypto
drm
dt-bindings linux-watchdog 6.7-rc1 tag 2023-11-09 13:54:25 -08:00
keys
kunit
kvm
linux Including fixes from bpf. 2023-11-23 10:40:13 -08:00
math-emu
media
memory
misc
net neighbour: Fix __randomize_layout crash in struct neighbour 2023-11-28 12:18:29 +01:00
pcmcia
ras
rdma
rv
scsi
soc IOMMU Updates for Linux v6.7 2023-11-09 13:37:28 -08:00
sound
target
trace rxrpc: Fix RTT determination to use any ACK as a source 2023-11-17 02:50:33 +00:00
uapi vhost,virtio,vdpa,firmware: bugfixes 2023-11-16 07:39:37 -05:00
ufs
vdso
video
xen xen/events: reduce externally visible helper functions 2023-11-14 09:29:28 +01:00