aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/nolibc
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2023-11-22 23:49:52 +0100
committerThomas Weißschuh <linux@weissschuh.net>2023-12-11 22:38:37 +0100
commitd543d9ddf593b1f4cb1d57d9ac0ad279fe18adaf (patch)
tree3ef4d9c6573d1f821e890663b8be46a0d9e9a112 /tools/testing/selftests/nolibc
parenttools/nolibc: add support for getrlimit/setrlimit (diff)
downloadwireguard-linux-d543d9ddf593b1f4cb1d57d9ac0ad279fe18adaf.tar.xz
wireguard-linux-d543d9ddf593b1f4cb1d57d9ac0ad279fe18adaf.zip
selftests/nolibc: disable coredump via setrlimit
qemu-user does has its own implementation of coredumping. That implementation does not respect the call to prctl(PR_SET_DUMPABLE, 0) in run_protection(). This leads to a coredump for every test run under qemu-user. Use also setrlimit() to inhibit coredump creation which is respected by qemu-user. Link: https://lore.kernel.org/qemu-devel/20231115-qemu-user-dumpable-v1-2-edbe7f0fbb02@t-8ch.de/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/lkml/20231123-nolibc-rlimit-v1-3-a428b131de2a@weissschuh.net/ Acked-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'tools/testing/selftests/nolibc')
-rw-r--r--tools/testing/selftests/nolibc/nolibc-test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index a0271ac313ee..6ba4f8275ac4 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1166,6 +1166,7 @@ static int run_protection(int min __attribute__((unused)),
{
pid_t pid;
int llen = 0, status;
+ struct rlimit rlimit = { 0, 0 };
llen += printf("0 -fstackprotector ");
@@ -1197,6 +1198,7 @@ static int run_protection(int min __attribute__((unused)),
close(STDERR_FILENO);
prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
+ setrlimit(RLIMIT_CORE, &rlimit);
smash_stack();
return 1;