[sanitizer] only lower the soft coresize limit in DisableCoreDumper

Stephan Bergmann sbergman at redhat.com
Thu Jul 3 04:42:07 PDT 2014


On 07/03/2014 10:06 AM, Kostya Serebryany wrote:
> what's the reason?

As stated, "so that e.g. a spawned sub-[process; sorry, typo in the 
original mail] could increase that limit again."  I needed this when 
debugging a scenario where a process built with -fsanitize=address 
spawns an "unrelated" process (not built with -fsanitize=address) and 
the easiest debug vector would have been to add a call to abort() at a 
certain place in the sub-process's code and afterwards analyze the 
corefile, if one could have been written.

Stephan

> On Wed, Jun 25, 2014 at 6:56 PM, Stephan Bergmann <sbergman at redhat.com
> <mailto:sbergman at redhat.com>> wrote:
>
>     ...so that e.g. a spawned sub-thread could increase that limit again:
>
>         Index: lib/sanitizer_common/__sanitizer_posix_libcdep.cc
>         ==============================__==============================__=======
>         --- lib/sanitizer_common/__sanitizer_posix_libcdep.cc
>         (revision 211695)
>         +++ lib/sanitizer_common/__sanitizer_posix_libcdep.cc
>         (working copy)
>         @@ -46,8 +46,10 @@
>
>           void DisableCoreDumper() {
>             struct rlimit nocore;
>         +  if (getrlimit(RLIMIT_CORE, &nocore) == -1) {
>         +      nocore.rlim_max = 0;
>         +  }
>             nocore.rlim_cur = 0;
>         -  nocore.rlim_max = 0;
>             setrlimit(RLIMIT_CORE, &nocore);
>           }
>




More information about the llvm-commits mailing list