[llvm] 077fe97 - [llvm-exegesis] Disable core dumps in subprocess (#74144)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 01:47:37 PST 2023
Author: Aiden Grossman
Date: 2023-12-04T01:47:33-08:00
New Revision: 077fe9773632b955ad114eeeb4153c734a9f5172
URL: https://github.com/llvm/llvm-project/commit/077fe9773632b955ad114eeeb4153c734a9f5172
DIFF: https://github.com/llvm/llvm-project/commit/077fe9773632b955ad114eeeb4153c734a9f5172.diff
LOG: [llvm-exegesis] Disable core dumps in subprocess (#74144)
Core dumps are currently enabled within the llvm-exegesis subprocess
executor. This can create a lot of core dumps when going through
different snippets that might segfault when experimenting with memory
annotations. These core dumps are not really needed as the information
about the segfault is reported directly to the user.
Added:
Modified:
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index 85375dec2a44c..33180d1099c7a 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -34,6 +34,7 @@
#endif
#include <sys/mman.h>
#include <sys/ptrace.h>
+#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/wait.h>
@@ -378,8 +379,21 @@ class SubProcessFunctionExecutorImpl
Twine(strsignal(ChildSignalInfo.si_signo)));
}
+ void disableCoreDumps() const {
+ struct rlimit rlim;
+
+ rlim.rlim_cur = 0;
+ setrlimit(RLIMIT_CORE, &rlim);
+ }
+
[[noreturn]] void prepareAndRunBenchmark(int Pipe,
const BenchmarkKey &Key) const {
+ // Disable core dumps in the child process as otherwise everytime we
+ // encounter an execution failure like a segmentation fault, we will create
+ // a core dump. We report the information directly rather than require the
+ // user inspect a core dump.
+ disableCoreDumps();
+
// The following occurs within the benchmarking subprocess
pid_t ParentPID = getppid();
More information about the llvm-commits
mailing list