Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Jan 2016 00:42:37 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 178396] [kernel] [patch] Add jid to kernel log when a process has been forced closed
Message-ID:  <bug-178396-8-j6dXysTtW6@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-178396-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-178396-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D178396

thomas@gibfest.dk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomas@gibfest.dk

--- Comment #3 from thomas@gibfest.dk ---
Created attachment 165129
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D165129&action=
=3Dedit
updated patch against stable/10 r293209

The original attachment in this bug no longer works since it doesn't use the
newish jailed() to check if the process is jailed.=20

The attachment I'm adding is a patch against stable/10 base r293209 which f=
ixes
the jailed detection, and also adds jail hostname to the log entry (when a =
jail
hostname is available).

For this patch to work on HEAD the exit1() call needs to be changed, no oth=
er
changes needed I think.

This patch could be a few lines shorter by only having one log() call, which
includes a empty string for nonjailed processes and something like ", jid: =
xxx
(example.com)" for jailed processes. The current is arguably more readable
though.

Testing with this patch applied:

-------------------------------------------------
[tykling@test /usr/src]$ sudo jail -c path=3D/ command=3D/bin/sh
# perl -e 'dump'
Abort trap (core dumped)
# ^Djail: /bin/sh: failed
[tykling@test /usr/src]$ sudo jail -c path=3D/ host.hostname=3Dexample.com
command=3D/bin/sh
# perl -e 'dump'
Abort trap (core dumped)
# ^Djail: /bin/sh: failed
[tykling@test /usr/src]$ perl -e 'dump'
Abort trap
[tykling@test /usr/src]$ dmesg | tail -3
pid 847 (perl), uid 0, jid 3: exited on signal 6 (core dumped)
pid 853 (perl), uid 0, jid 4 (example.com): exited on signal 6 (core dumped)
pid 857 (perl), uid 1001: exited on signal 6
[tykling@test /usr/src]$
-------------------------------------------------

I am not good with C so please feel free to comment on style and other
problems. Thanks :)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-178396-8-j6dXysTtW6>