From owner-p4-projects@FreeBSD.ORG Wed Dec 12 21:18:57 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CD282EDF; Wed, 12 Dec 2012 21:18:56 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85660EDD for ; Wed, 12 Dec 2012 21:18:56 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 507EA8FC12 for ; Wed, 12 Dec 2012 21:18:56 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.5/8.14.5) with ESMTP id qBCLIuJR005498 for ; Wed, 12 Dec 2012 21:18:56 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.5/8.14.5/Submit) id qBCLIuGD005495 for perforce@freebsd.org; Wed, 12 Dec 2012 21:18:56 GMT (envelope-from brooks@freebsd.org) Date: Wed, 12 Dec 2012 21:18:56 GMT Message-Id: <201212122118.qBCLIuGD005495@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 219900 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2012 21:18:57 -0000 http://p4web.freebsd.org/@@219900?ac=10 Change 219900 by brooks@brooks_zenith on 2012/12/12 21:18:14 Unconditionally allow the MIPS_GET_COUNT sysarch(). Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/kern/subr_syscall.c#7 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#12 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheri.h#17 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/kern/subr_syscall.c#7 (text+ko) ==== @@ -114,7 +114,8 @@ * Constrain code that can originate system calls if * userspace sandboxing is available. */ - error = cheri_syscall_authorize(td); + error = cheri_syscall_authorize(td, sa->code, + sa->narg, sa->args); if (error) goto retval; #endif ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#12 (text+ko) ==== @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -41,6 +42,7 @@ #include #include #include +#include /* * Beginnings of a programming interface for explicitly managing capability @@ -345,15 +347,21 @@ } /* - * Only allow system calls from sandboxes that hold ambient authority in + * Only allow most system calls from sandboxes that hold ambient authority in * userspace. */ int -cheri_syscall_authorize(struct thread *td) +cheri_syscall_authorize(struct thread *td, u_int code, int nargs, + register_t *args) { struct chericap c; /* + * Allow the cycle counter to be read via sysarch. + */ + if (code == SYS_sysarch && args[0] == MIPS_GET_COUNT) + return (0); + /* * Check whether userspace holds the rights defined in * cheri_capability_set_user() in $C0. Note that object type is * We might also consider checking $PCC here. ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheri.h#17 (text+ko) ==== @@ -340,7 +340,8 @@ struct cheri_frame *cf_srcp); void cheri_exec_setregs(struct thread *td); void cheri_log_exception(struct trapframe *frame, int trap_type); -int cheri_syscall_authorize(struct thread *td); +int cheri_syscall_authorize(struct thread *td, u_int code, + int nargs, register_t *args); #endif #endif /* _MIPS_INCLUDE_CHERI_H_ */