Page MenuHomeFreeBSD

kern: add some extra metadata to the coredump devctl notification
ClosedPublic

Authored by kevans on Sat, Jul 5, 3:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jul 11, 12:22 AM
Unknown Object (File)
Thu, Jul 10, 5:42 PM
Unknown Object (File)
Wed, Jul 9, 11:15 PM
Unknown Object (File)
Tue, Jul 8, 8:42 PM
Unknown Object (File)
Tue, Jul 8, 7:58 PM
Unknown Object (File)
Tue, Jul 8, 6:11 PM
Unknown Object (File)
Tue, Jul 8, 5:47 AM
Unknown Object (File)
Mon, Jul 7, 11:05 AM
Subscribers

Details

Summary

We already have a chance of cutting it close to the devctl limit
depending on the path, but this should be less than 50 bytes extra on
average. The jid gives us enough for userland to be able to actually
locate the corefile on disk in case it was produced in a jailed process,
the rest is just icing on the cake. We could extract pid/signo from the
core itself, but it's nice to be able to do some pre-filtering before
we even touch the core.

I'd like to use this in a (near-future) ucored port that will hoover up
corefiles from all over the system depending on some criteria.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kevans requested review of this revision.Sat, Jul 5, 3:36 AM
This revision is now accepted and ready to land.Sat, Jul 5, 3:56 AM
sys/kern/kern_sig.c
4262

Coredumping does not prevent reparenting, it occurs before exiting. Please see the sys/proc.h annotations for struct proc how to safely follow p_pptr.

4262

where 'it' == coredumping.

sys/kern/kern_sig.c
4262

Ahh, I missed that we drop the lock pretty early on. It also occurs to me that I probably want p->p_oppid anyways (which has the same constraints). I'll just grab them before we drop the lock, along with p_sig to have a snapshot of that consistent between corefile_open and here.

Collect most of the extra details before we drop the proc lock

The parent is c+e (proc_lock/proctree_lock) protected, but we dropped the lock
at the beginning. Rather than re-locking, just grab them before we drop the
lock initially. p_sig is unlocked/lazy, but we might as well grab it at the
same time for a consistent value between corefile_open() and the subsequent
devctl notification.

This revision now requires review to proceed.Sat, Jul 5, 3:50 PM
This revision is now accepted and ready to land.Sat, Jul 5, 3:53 PM