From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:22:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98268F60; Tue, 27 Nov 2012 10:22:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5FBCD8FC08; Tue, 27 Nov 2012 10:22:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARAMfFO041663; Tue, 27 Nov 2012 10:22:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARAMfUi041661; Tue, 27 Nov 2012 10:22:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271022.qARAMfUi041661@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243610 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:22:41 -0000 Author: pjd Date: Tue Nov 27 10:22:40 2012 New Revision: 243610 URL: http://svnweb.freebsd.org/changeset/base/243610 Log: Allow to use kill(2) in capability mode, but process can send a signal only to himself. For example abort(3) at first tries to do kill(getpid(), SIGABRT) which was failing in capability mode, so the code was failing back to exit(1). Reviewed by: rwatson Obtained from: WHEEL Systems MFC after: 2 weeks Modified: head/sys/kern/capabilities.conf head/sys/kern/kern_sig.c Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Tue Nov 27 10:16:48 2012 (r243609) +++ head/sys/kern/capabilities.conf Tue Nov 27 10:22:40 2012 (r243610) @@ -337,6 +337,11 @@ issetugid kevent ## +## Allow kill(2), as we allow the process to send signals only to himself. +## +kill + +## ## Allow message queue operations on file descriptors, subject to capability ## rights. ## Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Nov 27 10:16:48 2012 (r243609) +++ head/sys/kern/kern_sig.c Tue Nov 27 10:22:40 2012 (r243610) @@ -1679,6 +1679,14 @@ sys_kill(struct thread *td, struct kill_ struct proc *p; int error; + /* + * A process in capability mode can send signals only to himself. + * The main rationale behind this is that abort(3) is implemented as + * kill(getpid(), SIGABRT). + */ + if (IN_CAPABILITY_MODE(td) && uap->pid != td->td_proc->p_pid) + return (ECAPMODE); + AUDIT_ARG_SIGNUM(uap->signum); AUDIT_ARG_PID(uap->pid); if ((u_int)uap->signum > _SIG_MAXSIG)