https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=178396

tho...@gibfest.dk changed:

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

--- Comment #3 from tho...@gibfest.dk ---
Created attachment 165129
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=165129&action=edit
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. 

The attachment I'm adding is a patch against stable/10 base r293209 which fixes
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 other
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=/ command=/bin/sh
# perl -e 'dump'
Abort trap (core dumped)
# ^Djail: /bin/sh: failed
[tykling@test /usr/src]$ sudo jail -c path=/ host.hostname=example.com
command=/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 :)

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to