Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit Number of Core Dumps by Process Name

Tags:

linux

QUESTION Is there an easy, established and accepted way to limit the number of core dumps for a given process on Linux?

WHAT I WANT My ideal solution would be a one-line command to set the per-application limit of x core dumps for all applications. Alternatively, I would be happy with a method to set the limit for each application individually.

WHAT I DON'T WANT I know I can already set a limit for the size of the core dumps using ulimit. I don't want to limit the size of the dumps, just the number of them. I also know I could modify the apport script to get any functionality I desire, but I would like to avoid this if there is a less intrusive solution.

MOTIVATION I am working on a system that is sensitive to excessive disk usage. If a given application cores, I want to keep the core file so that I can debug the problem. If it cores again, which is highly likely since several applications are restarted by a watcher if they die, I don't want to keep the core file because it is unlikely to contain new information and it will just take up disk space.

like image 437
JimPri Avatar asked Nov 16 '25 14:11

JimPri


1 Answers

Process can coredump once, then it is killed. I presume you meant programs like in the rest of the question.

There is nothing of the sort in stock kernels, but things like grsecurity at least used to offer the relevant feature to tamper brute forcing against ASLR.

What do you need this for?


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!