Skip to content

Commit

Permalink
selftests/bpf: Disable strict aliasing for verifier_nocsr.c
Browse files Browse the repository at this point in the history
verfifier_nocsr.c fails to compile in GCC. The reason behind it was
initially explained in commit 27a90b1.

"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."

Signed-off-by: Cupertino Miranda <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
cupermir authored and anakryiko committed Aug 19, 2024
1 parent 955bba7 commit 2aa9369
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ progs/test_pkt_md_access.c-CFLAGS := -fno-strict-aliasing
progs/test_sk_lookup.c-CFLAGS := -fno-strict-aliasing
progs/timer_crash.c-CFLAGS := -fno-strict-aliasing
progs/test_global_func9.c-CFLAGS := -fno-strict-aliasing
progs/verifier_nocsr.c-CFLAGS := -fno-strict-aliasing

ifneq ($(LLVM),)
# Silence some warnings when compiled with clang
Expand Down

0 comments on commit 2aa9369

Please sign in to comment.