samples/bpf: Add -fsanitize=bounds to userspace programs
authorRuowen Qin <ruowenq2@illinois.edu>
Wed, 27 Sep 2023 04:50:30 +0000 (23:50 -0500)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 28 Sep 2023 16:31:05 +0000 (09:31 -0700)
commit9e09b75079e229b08f12a732712100fdb9af8cab
treeb12d556d10ab041bfa4b9e19f9befa31137a7dfd
parent0e73ef1d8c09a1f21ca2b19684819dbbcdce00f9
samples/bpf: Add -fsanitize=bounds to userspace programs

The sanitizer flag, which is supported by both clang and gcc, would make
it easier to debug array index out-of-bounds problems in these programs.

Make the Makfile smarter to detect ubsan support from the compiler and
add the '-fsanitize=bounds' accordingly.

Suggested-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Jinghao Jia <jinghao@linux.ibm.com>
Signed-off-by: Jinghao Jia <jinghao7@illinois.edu>
Signed-off-by: Ruowen Qin <ruowenq2@illinois.edu>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20230927045030.224548-2-ruowenq2@illinois.edu
samples/bpf/Makefile