@@ -104,24 +104,7 @@ static void setlim(int res, rlim_t lim) {
104
104
105
105
void DisableCoreDumperIfNecessary () {
106
106
if (common_flags ()->disable_coredump ) {
107
- rlimit rlim;
108
- CHECK_EQ (0 , getrlimit (RLIMIT_CORE, &rlim));
109
- // On Linux, if the kernel.core_pattern sysctl starts with a '|' (i.e. it
110
- // is being piped to a coredump handler such as systemd-coredumpd), the
111
- // kernel ignores RLIMIT_CORE (since we aren't creating a file in the file
112
- // system) except for the magic value of 1, which disables coredumps when
113
- // piping. 1 byte is too small for any kind of valid core dump, so it
114
- // also disables coredumps if kernel.core_pattern creates files directly.
115
- // While most piped coredump handlers do respect the crashing processes'
116
- // RLIMIT_CORE, this is notable not the case for Debian's systemd-coredump
117
- // due to a local patch that changes sysctl.d/50-coredump.conf to ignore
118
- // the specified limit and instead use RLIM_INFINITY.
119
- //
120
- // The alternative to using RLIMIT_CORE=1 would be to use prctl() with the
121
- // PR_SET_DUMPABLE flag, however that also prevents ptrace(), so makes it
122
- // impossible to attach a debugger.
123
- rlim.rlim_cur = Min<rlim_t >(SANITIZER_LINUX ? 1 : 0 , rlim.rlim_max );
124
- CHECK_EQ (0 , setrlimit (RLIMIT_CORE, &rlim));
107
+ setlim (RLIMIT_CORE, 0 );
125
108
}
126
109
}
127
110
0 commit comments