Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Oct 2009 15:25:53 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r198234 - projects/capabilities8/sys/amd64/amd64
Message-ID:  <200910191525.n9JFPr7R005252@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Mon Oct 19 15:25:53 2009
New Revision: 198234
URL: http://svn.freebsd.org/changeset/base/198234

Log:
  Merge Perforce c169596 into capabilities8 branch:
  
    amd64 also requires capability mode checks.
  
  Spotted by:	jonathan.anderson at cl.cam.ac.uk
  Sponsored by:	Google

Modified:
  projects/capabilities8/sys/amd64/amd64/trap.c

Modified: projects/capabilities8/sys/amd64/amd64/trap.c
==============================================================================
--- projects/capabilities8/sys/amd64/amd64/trap.c	Mon Oct 19 15:19:14 2009	(r198233)
+++ projects/capabilities8/sys/amd64/amd64/trap.c	Mon Oct 19 15:25:53 2009	(r198234)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
  * AMD64 Trap and System call handling
  */
 
+#include "opt_capabilities.h"
 #include "opt_clock.h"
 #include "opt_cpu.h"
 #include "opt_hwpmc_hooks.h"
@@ -68,6 +69,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/syscall.h>
 #include <sys/sysctl.h>
 #include <sys/sysent.h>
+#include <sys/ucred.h>
 #include <sys/uio.h>
 #include <sys/vmmeter.h>
 #ifdef KTRACE
@@ -961,6 +963,18 @@ syscall(struct trapframe *frame)
 
 	td->td_syscalls++;
 
+#ifdef CAPABILITIES
+	/*
+	 * In capabilities mode, we only allow access to system calls flagged
+	 * SYF_CAPENABLED.
+	 */
+	if (error == 0) {
+		if (!(callp->sy_flags & SYF_CAPENABLED) &&
+		    (td->td_ucred->cr_flags & CRED_FLAG_CAPMODE))
+			error = ENOSYS;
+	}
+#endif
+
 	if (error == 0) {
 		td->td_retval[0] = 0;
 		td->td_retval[1] = frame->tf_rdx;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910191525.n9JFPr7R005252>