[compiler-rt] r346284 - [sanitizer] Only set soft coredump limit.
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 6 17:03:27 PST 2018
Author: eugenis
Date: Tue Nov 6 17:03:26 2018
New Revision: 346284
URL: http://llvm.org/viewvc/llvm-project?rev=346284&view=rev
Log:
[sanitizer] Only set soft coredump limit.
Summary: If user wants to raise it back, let them.
Reviewers: kcc, vitalybuka
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D54190
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
compiler-rt/trunk/test/sanitizer_common/TestCases/corelimit.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc?rev=346284&r1=346283&r2=346284&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc Tue Nov 6 17:03:26 2018
@@ -94,10 +94,12 @@ static rlim_t getlim(int res) {
}
static void setlim(int res, rlim_t lim) {
- // The following magic is to prevent clang from replacing it with memset.
- volatile struct rlimit rlim;
+ struct rlimit rlim;
+ if (getrlimit(res, const_cast<struct rlimit *>(&rlim))) {
+ Report("ERROR: %s getrlimit() failed %d\n", SanitizerToolName, errno);
+ Die();
+ }
rlim.rlim_cur = lim;
- rlim.rlim_max = lim;
if (setrlimit(res, const_cast<struct rlimit *>(&rlim))) {
Report("ERROR: %s setrlimit() failed %d\n", SanitizerToolName, errno);
Die();
Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/corelimit.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/corelimit.cc?rev=346284&r1=346283&r2=346284&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/corelimit.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/corelimit.cc Tue Nov 6 17:03:26 2018
@@ -10,7 +10,7 @@ int main() {
getrlimit(RLIMIT_CORE, &lim_core);
void *p;
if (sizeof(p) == 8) {
- assert(0 == lim_core.rlim_max);
+ assert(0 == lim_core.rlim_cur);
}
return 0;
}
More information about the llvm-commits
mailing list