simpleperf: Disable core dump
Bug: 390626125
Test: run CtsSimpleperfTestCases
Change-Id: I84289426e1832a11683267c264c3ebb5196e78a6
diff --git a/simpleperf/main.cpp b/simpleperf/main.cpp
index 221ecd0..06ab81a 100644
--- a/simpleperf/main.cpp
+++ b/simpleperf/main.cpp
@@ -16,6 +16,7 @@
#if defined(__ANDROID__)
#include <android-base/properties.h>
+#include <sys/prctl.h>
#endif
#include "command.h"
@@ -75,6 +76,8 @@
if (!AndroidSecurityCheck()) {
return 1;
}
+ // Disable core dump to avoid leaking raw sample info.
+ prctl(PR_SET_DUMPABLE, 0);
#endif
RegisterAllCommands();
return RunSimpleperfCmd(argc, argv) ? 0 : 1;