linux-stable/tools/testing
Jose E. Marchesi 27a90b14b9 bpf: Build type-punning BPF selftests with -fno-strict-aliasing
A few BPF selftests perform type punning and they may break strict
aliasing rules, which are exploited by both GCC and clang by default
while optimizing.  This can lead to broken compiled programs.

This patch disables strict aliasing for these particular tests, by
mean of the -fno-strict-aliasing command line option.  This will make
sure these tests are optimized properly even if some strict aliasing
rule gets violated.

After this patch, GCC is able to build all the selftests without
warning about potential strict aliasing issue.

bpf@vger discussion on strict aliasing and BPF selftests:
https://lore.kernel.org/bpf/bae1205a-b6e5-4e46-8e20-520d7c327f7a@linux.dev/T/#t

Tested in bpf-next master.
No regressions.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/bae1205a-b6e5-4e46-8e20-520d7c327f7a@linux.dev
Link: https://lore.kernel.org/bpf/20240130110343.11217-1-jose.marchesi@oracle.com
2024-01-30 16:08:18 +01:00
..
crypto/chacha20-s390
cxl Merge branch 'for-6.8/cxl-cper' into for-6.8/cxl 2024-01-09 19:21:44 -08:00
fault-injection
ktest
kunit kunit: tool: add test for parsing attributes 2023-12-18 13:21:15 -07:00
memblock mm, treewide: rename MAX_ORDER to MAX_PAGE_ORDER 2024-01-08 15:27:15 -08:00
nvdimm tools/testing/nvdimm: Add compile-test coverage for ndtest 2023-12-15 17:07:12 +01:00
radix-tree maple_tree: fix warning comparing pointer to 0 2023-12-20 14:48:12 -08:00
scatterlist
selftests bpf: Build type-punning BPF selftests with -fno-strict-aliasing 2024-01-30 16:08:18 +01:00
vsock vsock/test: print type for SOCK_SEQPACKET 2024-01-25 16:39:21 -08:00