[llvm] [Support] Fix Process::PreventCoreFiles() when coredumps are piped (PR #83703)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 21:23:23 PST 2024


MaskRay wrote:

> I considered that, but according to the manpage it means we can't ptrace the process afterwards:
> 
> > Processes that are not dumpable can not be attached via [ptrace(2)](https://man7.org/linux/man-pages/man2/ptrace.2.html) PTRACE_ATTACH; see [ptrace(2)](https://man7.org/linux/man-pages/man2/ptrace.2.html) for further details.
> > If a process is not dumpable, the ownership of files in the process's /proc/pid directory is affected as described in [proc(5)](https://man7.org/linux/man-pages/man5/proc.5.html).
> 
> It does look like it will add to dmesg (but it already seems flooded with lots of other messages):
> 
> ```
> [  +0.218577] traps: bounds.cpp.tmp[244068] trap invalid opcode ip:561028d05dc9 sp:7ffddaacc640 error:0 in bounds.cpp.tmp[561028c32000+d4000]
> [  +0.013130] Process 244068(bounds.cpp.tmp) has RLIMIT_CORE set to 1
> [  +0.006593] Aborting core
> ```
> 
> Is this a dealbreak? I can see if another value avoids the coredump without spamming dmesg.

It isn't a dealbreaker. Since `PR_SET_DUMPABLE 0` would disable `PTRACE_ATTACH`, a feature which I consider more important, it seems that we should just tolerate it...

https://github.com/llvm/llvm-project/pull/83703


More information about the llvm-commits mailing list