Thanks for the answers! libSegFault.so seems to do what I want. I'll replace sysctl -w kernel.print-fatal-signals=1 with export LD_PRELOAD=/lib/libSegFault.so since it better suits my needs.