Skip to content

Commit d543d9d

Browse files
committed
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>
1 parent a0bb5f8 commit d543d9d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tools/testing/selftests/nolibc/nolibc-test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,7 @@ static int run_protection(int min __attribute__((unused)),
11661166
{
11671167
pid_t pid;
11681168
int llen = 0, status;
1169+
struct rlimit rlimit = { 0, 0 };
11691170

11701171
llen += printf("0 -fstackprotector ");
11711172

@@ -1197,6 +1198,7 @@ static int run_protection(int min __attribute__((unused)),
11971198
close(STDERR_FILENO);
11981199

11991200
prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
1201+
setrlimit(RLIMIT_CORE, &rlimit);
12001202
smash_stack();
12011203
return 1;
12021204

0 commit comments

Comments
 (0)