From owner-p4-projects@FreeBSD.ORG Tue Nov 13 16:49:37 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2BF4E867; Tue, 13 Nov 2012 16:49:37 +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 DDB5A865 for ; Tue, 13 Nov 2012 16:49:36 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id C319C8FC08 for ; Tue, 13 Nov 2012 16:49:36 +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 qADGna6x030308 for ; Tue, 13 Nov 2012 16:49:36 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.5/8.14.5/Submit) id qADGnaBP030305 for perforce@freebsd.org; Tue, 13 Nov 2012 16:49:36 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 13 Nov 2012 16:49:36 GMT Message-Id: <201211131649.qADGnaBP030305@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 219768 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: Tue, 13 Nov 2012 16:49:37 -0000 http://p4web.freebsd.org/@@219768?ac=10 Change 219768 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2012/11/13 16:48:52 Export a counter of CHERI system call violations (i.e., blocked attempts to directly invoke system calls from within a sandbox). Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#10 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cheri.c#10 (text+ko) ==== @@ -33,9 +33,11 @@ #include #include #include +#include #include +#include #include #include @@ -54,6 +56,14 @@ * call, and reload them afterwards. */ +static SYSCTL_NODE(_security, OID_AUTO, cheri, CTLFLAG_RD, 0, + "CHERI parameters and statistics"); + +/* XXXRW: Should possibly be u_long. */ +static u_int security_cheri_syscall_violations; +SYSCTL_UINT(_security_cheri, OID_AUTO, syscall_violations, CTLFLAG_RD, + &security_cheri_syscall_violations, 0, "Number of system calls blocked"); + /* * Given an existing more privileged capability (fromcrn), build a new * capability in tocrn with the contents of the passed flattened @@ -346,8 +356,10 @@ intr_enable(); if (c.c_perms != CHERI_CAP_USER_PERMS || c.c_base != CHERI_CAP_USER_BASE || - c.c_length != CHERI_CAP_USER_LENGTH) + c.c_length != CHERI_CAP_USER_LENGTH) { + atomic_add_int(&security_cheri_syscall_violations, 1); return (ECAPMODE); + } return (0); }