linux-stable/include/uapi
Kees Cook 96c677fca5 UAPI: ethtool: Avoid flex-array in struct ethtool_link_settings
struct ethtool_link_settings tends to be used as a header for other
structures that have trailing bytes[1], but has a trailing flexible array
itself. Using this overlapped with other structures leads to ambiguous
object sizing in the compiler, so we want to avoid such situations (which
have caused real bugs in the past). Detecting this can be done with
-Wflex-array-member-not-at-end, which will need to be enabled globally.

Using a tagged struct_group() to create a new ethtool_link_settings_hdr
structure isn't possible as it seems we cannot use the tagged variant of
struct_group() due to syntax issues from C++'s perspective (even within
"extern C")[2]. Instead, we can just leave the offending member defined
in UAPI and remove it from the kernel's view of the structure, as Linux
doesn't actually use this member at all. There is also no change in
size since it was already a flexible array that didn't contribute to
size returned by any use of sizeof().

Reported-by: Jakub Kicinski <kuba@kernel.org>
Closes: https://lore.kernel.org/lkml/20241109100213.262a2fa0@kernel.org/ [2]
Link: https://lore.kernel.org/lkml/0bc2809fe2a6c11dd4c8a9a10d9bd65cccdb559b.1730238285.git.gustavoars@kernel.org/ [1]
Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20241115204308.3821419-3-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-11-18 18:52:11 -08:00
..
asm-generic net_tstamp: add SCM_TS_OPT_ID to provide OPT_ID in control message 2024-10-04 11:52:19 -07:00
drm Linux 6.11-rc7 2024-09-11 09:18:15 +02:00
linux UAPI: ethtool: Avoid flex-array in struct ethtool_link_settings 2024-11-18 18:52:11 -08:00
misc Revert "misc: fastrpc: Restrict untrusted app to attach to privileged PD" 2024-08-15 16:59:14 +02:00
mtd ubi: fastmap: Add control in 'UBI_IOCATT' ioctl to reserve PEBs for filling pools 2023-10-28 23:16:00 +02:00
rdma RDMA/nldev: Expose whether RDMA monitoring is supported 2024-09-13 08:29:34 +03:00
regulator uapi: regulator: Fix typo 2024-01-04 13:22:24 +00:00
scsi scsi: mpi3mr: Add ioctl support for HDB 2024-06-26 23:30:09 -04:00
sound ASoC: topology: Bump minimal topology ABI version 2024-10-10 12:15:03 +01:00
video
xen xen/privcmd: Add new syscall to get gsi from dev 2024-09-25 09:54:55 +02:00
Kbuild