From owner-svn-src-all@freebsd.org Sat Dec 29 21:36:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56C23142DA82; Sat, 29 Dec 2018 21:36:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFFED86476; Sat, 29 Dec 2018 21:36:02 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3D6B18D19; Sat, 29 Dec 2018 21:36:02 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wBTLa28g072561; Sat, 29 Dec 2018 21:36:02 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wBTLa25i072560; Sat, 29 Dec 2018 21:36:02 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201812292136.wBTLa25i072560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 29 Dec 2018 21:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342599 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 342599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EFFED86476 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Dec 2018 21:36:03 -0000 Author: kp Date: Sat Dec 29 21:36:02 2018 New Revision: 342599 URL: https://svnweb.freebsd.org/changeset/base/342599 Log: Simplify jail ID printing on process exit As suggested by kib@, we don't need to check p_ucred, because that's only NULL during process creation, and cr_prison is never NULL. Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sat Dec 29 21:18:01 2018 (r342598) +++ head/sys/kern/kern_sig.c Sat Dec 29 21:36:02 2018 (r342599) @@ -3094,16 +3094,12 @@ proc_wkilled(struct proc *p) void killproc(struct proc *p, char *why) { - int jid = -1; - if (p->p_ucred && p->p_ucred->cr_prison) - jid = p->p_ucred->cr_prison->pr_id; - PROC_LOCK_ASSERT(p, MA_OWNED); CTR3(KTR_PROC, "killproc: proc %p (pid %d, %s)", p, p->p_pid, p->p_comm); log(LOG_ERR, "pid %d (%s), jid %d, uid %d, was killed: %s\n", - p->p_pid, p->p_comm, jid, + p->p_pid, p->p_comm, p->p_ucred->cr_prison->pr_id, p->p_ucred ? p->p_ucred->cr_uid : -1, why); proc_wkilled(p); kern_psignal(p, SIGKILL); @@ -3121,11 +3117,7 @@ void sigexit(struct thread *td, int sig) { struct proc *p = td->td_proc; - int jid = -1; - if (p->p_ucred && p->p_ucred->cr_prison) - jid = p->p_ucred->cr_prison->pr_id; - PROC_LOCK_ASSERT(p, MA_OWNED); p->p_acflag |= AXSIG; /* @@ -3152,7 +3144,8 @@ sigexit(struct thread *td, int sig) if (kern_logsigexit) log(LOG_INFO, "pid %d (%s), jid %d, uid %d: exited on " - "signal %d%s\n", p->p_pid, p->p_comm, jid, + "signal %d%s\n", p->p_pid, p->p_comm, + p->p_ucred->cr_prison->pr_id, td->td_ucred ? td->td_ucred->cr_uid : -1, sig &~ WCOREFLAG, sig & WCOREFLAG ? " (core dumped)" : "");