Re: [PATCH bpf v2 15/15] selftests/bpf: Don't override SIGSEGV handler with ASAN

From: Mykyta Yatsenko

Date: Wed Feb 18 2026 - 10:13:01 EST


On 2/18/26 00:30, Ihor Solodrai wrote:
test_progs has custom SIGSEGV handler, which interferes with the
address sanitizer [1]. Add an #ifndef to avoid this.

[1] https://lore.kernel.org/bpf/73d832948b01dbc0ebc60d85574bdf8537f3a810.camel@xxxxxxxxx/

Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
---
tools/testing/selftests/bpf/test_progs.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 02a85dda30e6..b533cede933d 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1944,13 +1944,15 @@ int main(int argc, char **argv)
.parser = parse_arg,
.doc = argp_program_doc,
};
+ int err, i;
+
+#ifndef __SANITIZE_ADDRESS__
struct sigaction sigact = {
.sa_handler = crash_handler,
.sa_flags = SA_RESETHAND,
- };
- int err, i;
-
+ };
sigaction(SIGSEGV, &sigact, NULL);
+#endif
env.stdout_saved = stdout;
env.stderr_saved = stderr;
I think this is reasonable for the use case. We may try dumping logs
in |__asan_on_error(), if that proves useful.
Acked-by: Mykyta Yatsenko <yatsenko@xxxxxxxx>|