From owner-svn-src-all@FreeBSD.ORG Tue Mar 1 13:32:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E6D81065678; Tue, 1 Mar 2011 13:32:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D20E8FC0A; Tue, 1 Mar 2011 13:32:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p21DW8Bg028359; Tue, 1 Mar 2011 13:32:08 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p21DW854028357; Tue, 1 Mar 2011 13:32:08 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201103011332.p21DW854028357@svn.freebsd.org> From: Robert Watson Date: Tue, 1 Mar 2011 13:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219133 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 01 Mar 2011 13:32:08 -0000 Author: rwatson Date: Tue Mar 1 13:32:07 2011 New Revision: 219133 URL: http://svn.freebsd.org/changeset/base/219133 Log: Continue introducing Capsicum capability mode support: If a system call wasn't listed in capabilities.conf, return ECAPMODE at syscall entry. Reviewed by: anderson Discussed with: benl, kris, pjd Sponsored by: Google, Inc. Obtained from: Capsicum Project MFC after: 3 months Modified: head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Tue Mar 1 13:30:23 2011 (r219132) +++ head/sys/kern/subr_trap.c Tue Mar 1 13:32:07 2011 (r219133) @@ -44,12 +44,14 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_capabilities.h" #include "opt_ktrace.h" #include "opt_kdtrace.h" #include "opt_sched.h" #include #include +#include #include #include #include @@ -310,6 +312,19 @@ syscallenter(struct thread *td, struct s if (error != 0) goto retval; } + +#ifdef CAPABILITIES + /* + * In capability mode, we only allow access to system calls + * flagged with SYF_CAPENABLED. + */ + if (IN_CAPABILITY_MODE(td) && + !(sa->callp->sy_flags & SYF_CAPENABLED)) { + error = ECAPMODE; + goto retval; + } +#endif + error = syscall_thread_enter(td, sa->callp); if (error != 0) goto retval;