[all-commits] [llvm/llvm-project] 0db2e1: Reland "[compiler-rt] Avoid generating coredumps w...
Alexander Richardson via All-commits
all-commits at lists.llvm.org
Mon Mar 18 10:14:51 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0db2e1e91a9124c276fd00f674b71f038a53ddec
https://github.com/llvm/llvm-project/commit/0db2e1e91a9124c276fd00f674b71f038a53ddec
Author: Alex Richardson <alexrichardson at google.com>
Date: 2024-03-18 (Mon, 18 Mar 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
M compiler-rt/test/sanitizer_common/TestCases/corelimit.cpp
Log Message:
-----------
Reland "[compiler-rt] Avoid generating coredumps when piped to a tool"
Updated the corelimit.cpp test to handle buildbots with RLIMIT_CORE
rlim_max already set to zero.
Original commit message:
I was trying to debug why `ninja check-compiler-rt` was taking so long
to run on my system and after some debugging it turned out that most of
the time was being spent generating core dumps.
On many current Linux systems, coredumps are no longer dumped in the CWD
but instead piped to a utility such as systemd-coredumpd that stores
them in a deterministic location. This can be done by setting the
kernel.core_pattern sysctl to start with a '|'. However, when using such
a setup the kernel ignores a coredump limit of 0 (since there is no file
being written) and we can end up piping many gigabytes of data to
systemd-coredumpd which causes the test suite to freeze for a long time.
While most piped coredump handlers do respect the crashing processes'
RLIMIT_CORE, this is notable not the case for Debian's systemd-coredump
due to a local patch that changes sysctl.d/50-coredump.conf to ignore
the specified limit and instead use RLIM_INFINITY
(https://salsa.debian.org/systemd-team/systemd/-/commit/64599ffe44f0d).
Fortunately there is a workaround: the kernel recognizes the magic value
of 1 for RLIMIT_CORE to disable coredumps when piping. One byte is also
too small to generate any coredump, so it effectively behaves as if we
had set the value to zero.
The alternative to using RLIMIT_CORE=1 would be to use prctl() with the
PR_SET_DUMPABLE flag, however that also prevents ptrace(), so makes it
impossible to attach a debugger.
Fixes: https://github.com/llvm/llvm-project/issues/45797
This reverts commit 0b9f19a9880eb786871194af116f223d2ad30c52.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list