svn commit: r198234 - projects/capabilities8/sys/amd64/amd64
Robert Watson
rwatson at FreeBSD.org
Mon Oct 19 15:25:54 UTC 2009
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;
More information about the svn-src-projects
mailing list