Page MenuHomeFreeBSD

abort2: Generate a core dump
ClosedPublic

Authored by jhb on Oct 11 2023, 9:20 PM.
Tags
None
Referenced Files
F87358509: D42163.diff
Tue, Jul 2, 2:24 AM
F87310113: D42163.id.diff
Mon, Jul 1, 3:10 PM
F87300950: D42163.id128615.diff
Mon, Jul 1, 12:07 PM
F87300899: D42163.id.diff
Mon, Jul 1, 12:06 PM
Unknown Object (File)
Mon, Jul 1, 2:27 AM
Unknown Object (File)
Mon, Jul 1, 2:10 AM
Unknown Object (File)
Mon, Jul 1, 2:08 AM
Unknown Object (File)
Mon, Jun 24, 6:22 PM
Subscribers

Details

Summary

Call sigexit rather than exit1 so that a core is generated.

If running the SIGABRT handler is desired, this would need to use
kern_psignal() instead. In that case a userspace wrapper in libc
would be needed to force an exit if the handler doesn't exit. Given
that abort2(2)'s intended use case is when userland is in a
sufficiently bad state such that it can't safely call syslog(3) before
abort(3), a userspace abort2(3) wrapper in libc might be dubious.

Diff Detail

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

Event Timeline

jhb requested review of this revision.Oct 11 2023, 9:20 PM

This change is a clear improvement (core dumped on SIGABRT), so IMHO should go in regardless of the "executing the SIGABRT handler" refinement.

sys/kern/kern_exit.c
831–832

sigexit() doesn't return (as exit1()), so the call to PROC_UNLOCK() is unnecesary, as well as the return.

I would remove them. I don't know for sure if there are still relevant compilers that would issue a warning or even an error about the function not containing a return statement at end, but I can say it's not a problem for clang 16.

jhb marked an inline comment as done.Oct 20 2023, 5:46 PM
This revision is now accepted and ready to land.Oct 20 2023, 7:52 PM
This revision was automatically updated to reflect the committed changes.