summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenaud Métrich <rmetrich@redhat.com>2021-10-06 16:07:15 +0200
committerDmitry V. Levin <ldv@strace.io>2021-10-12 08:00:00 +0000
commitf78d8e0c2f6155ac7b058269bf4adf04ad473a3c (patch)
tree2be1d2ac7d64d9fce5437c4c8c811b3fe2485371
parentf25cba0992ba8a1a695b28dd11d8cd7f940b6c24 (diff)
downloadstrace-f78d8e0c2f6155ac7b058269bf4adf04ad473a3c.tar.gz
tests/pc: avoid program from creating a coredump
* tests/pc.c: Include <sys/prctl.h>. (main): Clear the dumpable attribute right before raising SIGSEGV.
-rw-r--r--tests/pc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/pc.c b/tests/pc.c
index 342169f5d..9ebc43efb 100644
--- a/tests/pc.c
+++ b/tests/pc.c
@@ -14,6 +14,7 @@
#include <sys/mman.h>
#include <sys/wait.h>
#include <sys/sendfile.h>
+#include <sys/prctl.h>
int main(void)
{
@@ -58,6 +59,9 @@ int main(void)
size <<= 1;
}
+ /* Avoid creating core dumps */
+ (void) prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
+
/* SIGSEGV is expected */
(void) munmap((void *) addr, size);
(void) munmap((void *) addr, size);