Date: Tue, 7 May 2013 14:04:25 GMT From: Clement Moulin <freebsd@simplerezo.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/178396: Add jid to kernel log when a process has been forced closed Message-ID: <201305071404.r47E4PlU099879@oldred.FreeBSD.org> Resent-Message-ID: <201305071410.r47EA0Zi048418@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 178396 >Category: kern >Synopsis: Add jid to kernel log when a process has been forced closed >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue May 07 14:10:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Clement Moulin >Release: 9.0 >Organization: SimpleRezo >Environment: FreeBSD XXX.simplerezo.com 9.0-RELEASE-p4 FreeBSD 9.0-RELEASE-p4 #0: Thu Aug 16 12:10:44 CEST 2012 root@XXX.simplerezo.com:/usr/obj/storage/freebsd/src/sys/KERNEL amd64 >Description: When process is forced killed, kernel log "process %pid (%processname), uid %uid: exited on signal %sid". In a system hosting jails, this message, since it is produced by kernel, is logged on the host. I'm suggesting to also log JID for "debugging" purpose: in my case, i have several jails, each with an apache process, and without JID information, i'm not able to find which one is causing "httpd: exiting on signal 10", without reading every apache error logs of each jail... >How-To-Repeat: >Fix: See proposal patch in attachment. Patch attached with submission follows: --- kern_sig.c.orig 2013-05-07 11:11:44.000000000 +0200 +++ kern_sig.c 2013-05-07 11:33:52.000000000 +0200 @@ -2869,12 +2869,21 @@ if (coredump(td) == 0) sig |= WCOREFLAG; if (kern_logsigexit) - log(LOG_INFO, - "pid %d (%s), uid %d: exited on signal %d%s\n", - p->p_pid, p->p_comm, - td->td_ucred ? td->td_ucred->cr_uid : -1, - sig &~ WCOREFLAG, - sig & WCOREFLAG ? " (core dumped)" : ""); + if (p->p_flag & P_JAILED) + log(LOG_INFO, + "pid %d (%s), uid %d, jid %d: exited on signal %d%s\n", + p->p_pid, p->p_comm, + td->td_ucred ? td->td_ucred->cr_uid : -1, + p->p_ucred ? p->p_ucred->cr_prison->pr_id : -1, + sig &~ WCOREFLAG, + sig & WCOREFLAG ? " (core dumped)" : ""); + else + log(LOG_INFO, + "pid %d (%s), uid %d: exited on signal %d%s\n", + p->p_pid, p->p_comm, + td->td_ucred ? td->td_ucred->cr_uid : -1, + sig &~ WCOREFLAG, + sig & WCOREFLAG ? " (core dumped)" : ""); } else PROC_UNLOCK(p); exit1(td, W_EXITCODE(0, sig)); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305071404.r47E4PlU099879>