twx-linux/tools
Alexander Lobakin 23681bc4b5 stddef: make __struct_group() UAPI C++-friendly
[ Upstream commit 724c6ce38bbaeb4b3f109b0e066d6c0ecd15446c ]

For the most part of the C++ history, it couldn't have type
declarations inside anonymous unions for different reasons. At the
same time, __struct_group() relies on the latters, so when the @TAG
argument is not empty, C++ code doesn't want to build (even under
`extern "C"`):

../linux/include/uapi/linux/pkt_cls.h:25:24: error:
'struct tc_u32_sel::<unnamed union>::tc_u32_sel_hdr,' invalid;
an anonymous union may only have public non-static data members
[-fpermissive]

The safest way to fix this without trying to switch standards (which
is impossible in UAPI anyway) etc., is to disable tag declaration
for that language. This won't break anything since for now it's not
buildable at all.
Use a separate definition for __struct_group() when __cplusplus is
defined to mitigate the error, including the version from tools/.

Fixes: 50d7bd38c3aa ("stddef: Introduce struct_group() helper macro")
Reported-by: Christopher Ferris <cferris@google.com>
Closes: https://lore.kernel.org/linux-hardening/Z1HZpe3WE5As8UAz@google.com
Suggested-by: Kees Cook <kees@kernel.org> # __struct_group_tag()
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20241219135734.2130002-1-aleksander.lobakin@intel.com
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-02 10:32:03 +01:00
..
accounting
arch tools/x86/kcpuid: Protect against faulty "max subleaf" values 2024-10-10 11:57:29 +02:00
bootconfig
bpf bpftool: fix potential NULL pointer dereferencing in prog_dump() 2024-12-14 19:59:48 +01:00
build
certs
cgroup
counter
crypto/ccp
debugging
edid
firewire
firmware
gpio
hv tools: hv: change permissions of NetworkManager configuration file 2024-12-27 13:58:46 +01:00
iio tools/iio: Add memory allocation failure check for trigger_name 2024-10-17 15:24:20 +02:00
include stddef: make __struct_group() UAPI C++-friendly 2025-01-02 10:32:03 +01:00
kvm/kvm_stat
laptop
leds
lib libbpf: never interpret subprogs in .text as entry programs 2024-12-09 10:32:03 +01:00
memory-model tools/memory-model: Fix bug in lock.cat 2024-08-03 08:54:21 +02:00
mm tools/mm: fix compile error 2024-11-22 15:38:33 +01:00
net/ynl
objtool objtool/x86: allow syscall instruction 2024-12-19 18:11:36 +01:00
pci
pcmcia
perf perf trace: Avoid garbage when not printing a syscall's arguments 2024-12-09 10:32:29 +01:00
power pm:cpupower: Add missing powercap_set_enabled() stub function 2024-10-04 16:28:55 +02:00
rcu
scripts tools: Override makefile ARCH variable if defined, but empty 2024-12-14 19:59:49 +01:00
spi
testing selftests/bpf: Use asm constraint "m" for LoongArch 2024-12-27 13:58:55 +01:00
thermal
time
tracing rtla/timerlat: Make timerlat_hist_cpu->*_count unsigned long long 2024-12-19 18:11:26 +01:00
usb usbip: tools: Fix detach_port() invalid port error path 2024-11-08 16:28:22 +01:00
verification verification/dot2: Improve dot parser robustness 2024-12-14 20:00:13 +01:00
virtio
wmi
workqueue
Makefile