selftests/nolibc: prevent coredumps during test execution
authorThomas Weißschuh <linux@weissschuh.net>
Fri, 26 May 2023 07:51:20 +0000 (09:51 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 9 Jun 2023 18:46:09 +0000 (11:46 -0700)
The child process forked during stackprotector tests intentionally gets
killed with SIGABRT. By default this will trigger writing a coredump.
The writing of the coredump can spam the systems coredump machinery and
take some time.

Timings for the full run of nolibc-test:
Before: 200ms
After:   20ms

This is on a desktop x86 system with systemd-coredumpd enabled.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/nolibc/nolibc-test.c

index 6db788603a3481226f21deb734f93ca982ce9695..84a1b02eb6f9da2e6fe1df4355c0ec638042f7aa 100644 (file)
@@ -831,6 +831,7 @@ static int run_protection(int min, int max)
                close(STDOUT_FILENO);
                close(STDERR_FILENO);
 
+               prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
                smash_stack();
                return 1;