Page MenuHomeFreeBSD

Make kernel print jail ID when logging a process exit.
ClosedPublic

Authored by marieheleneka_gmail.com on Dec 20 2018, 10:46 AM.
Tags
None
Referenced Files
F106134788: D18618.diff
Wed, Dec 25, 11:37 PM
F106095057: D18618.id52193.diff
Wed, Dec 25, 7:55 AM
Unknown Object (File)
Tue, Dec 24, 7:53 AM
Unknown Object (File)
Mon, Dec 9, 5:07 AM
Unknown Object (File)
Sun, Dec 8, 10:30 PM
Unknown Object (File)
Nov 19 2024, 12:51 PM
Unknown Object (File)
Nov 8 2024, 2:12 AM
Unknown Object (File)
Nov 5 2024, 3:45 PM
Subscribers

Details

Summary

Previously, when a process was killed (ex: core dumped), the kernel would log a message like this:
pid 74906 (top), uid 0: exited on signal 11 (core dumped)

The message now looks like this:
pid 66526 (top), jid: 1, uid 0: exited on signal 11 (core dumped)

"jid" will be 0 for processes not running in a jail, which is in line with other parts of the system. (ex: "ps -J 0" to show unjailed processes)
"jid" will be -1 if the jid information is unavailable for some reason. (this should ordinarily not happen, but I've not dug enough in the code to guarantee it won't ever happen.)

Suggested commit message:
Kernel now includes jail ID when logging a process exit. jid is 0 for unjailed processes.

Submitted by: Marie Helene Kvello-Aune <freebsd@mhka.no>
Sponsored by: Modirum MDPay
relnotes: yes

Test Plan

Apply patch, build & install kernel.
Spin up a few jails
Check dmesg output after running "kill -11" on a few jailed and unjailed processes.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Added jid to log message for sigexit as well.
Made formatting more consistent (removed a colon)

In D18618#397024, @mjg wrote:

That diff looks interesting, and it made me realize I had missed sigexit. That's fixed now.

I much prefer D27's way of formatting things, but it seems to me it's dead in the water.

Made code a bit more readable by storing jid as a variable, instead of double ?: syntax.
Fixed trailing whitespace.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 29 2018, 2:49 PM
This revision was automatically updated to reflect the committed changes.