From owner-p4-projects@FreeBSD.ORG Mon Nov 5 13:02:00 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5A370D16; Mon, 5 Nov 2012 13:02:00 +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 F362FD14 for ; Mon, 5 Nov 2012 13:01:59 +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 D80258FC08 for ; Mon, 5 Nov 2012 13:01:59 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id qA5D1xfC002110 for ; Mon, 5 Nov 2012 13:01:59 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id qA5D1x9R002107 for perforce@freebsd.org; Mon, 5 Nov 2012 13:01:59 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 5 Nov 2012 13:01:59 GMT Message-Id: <201211051301.qA5D1x9R002107@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 219602 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: Mon, 05 Nov 2012 13:02:00 -0000 http://p4web.freebsd.org/@@219602?ac=10 Change 219602 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/11/05 13:01:32 Define a very basic CHERI exception handler for userspace, which maps into a new SIGPROT signal that, uncaught, terminates the generating application. Continue to panic the kernel if it generates a CHERI exception. In the futue, it would be nice to trigger a core dump and more detailed debugging information, but this is a marked functional improvement in the mean time! Affected files ... .. //depot/projects/ctsrd/cheribsd/src/lib/libc/gen/signal.3#3 edit .. //depot/projects/ctsrd/cheribsd/src/lib/libc/nls/C.msg#2 edit .. //depot/projects/ctsrd/cheribsd/src/lib/libc/sys/sigaction.2#2 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cherireg.h#8 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/mips/trap.c#8 edit .. //depot/projects/ctsrd/cheribsd/src/sys/sys/signal.h#3 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/lib/libc/gen/signal.3#3 (text+ko) ==== @@ -28,7 +28,7 @@ .\" @(#)signal.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD: src/lib/libc/gen/signal.3,v 1.44 2012/06/16 06:38:11 joel Exp $ .\" -.Dd June 7, 2004 +.Dd November 5, 2012 .Dt SIGNAL 3 .Os .Sh NAME @@ -132,6 +132,7 @@ .It 30 Ta Dv SIGUSR1 Ta "terminate process" Ta "User defined signal 1" .It 31 Ta Dv SIGUSR2 Ta "terminate process" Ta "User defined signal 2" .It 32 Ta Dv SIGTHR Ta "terminate process" Ta "thread interrupt" +.It 34 Ta Dv SIGPROT Ta "terminate process" Ta "in-process protection exception" .El .Pp The ==== //depot/projects/ctsrd/cheribsd/src/lib/libc/nls/C.msg#2 (text+ko) ==== @@ -257,6 +257,10 @@ 30 User defined signal 1 $ SIGUSR2 31 User defined signal 2 +$ SIGTHR +32 Thread interrupt +$ SIGPROT +33 In-process protection exception $ $ gai_strerror() support catalog $ ==== //depot/projects/ctsrd/cheribsd/src/lib/libc/sys/sigaction.2#2 (text+ko) ==== @@ -28,7 +28,7 @@ .\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94 .\" $FreeBSD: src/lib/libc/sys/sigaction.2,v 1.62 2010/05/06 22:49:54 jilles Exp $ .\" -.Dd April 18, 2010 +.Dd November 5, 2012 .Dt SIGACTION 2 .Os .Sh NAME @@ -331,6 +331,8 @@ .It Dv SIGINFO No " discard signal" " status request from keyboard" .It Dv SIGUSR1 No " terminate process" " User defined signal 1" .It Dv SIGUSR2 No " terminate process" " User defined signal 2" +.It Dv SIGTHR No " discard signal" " thread interrupt" +.It Dv SIGPROT No " discard signal" " in-process protection exception" .El .Sh NOTE The ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cherireg.h#8 (text+ko) ==== ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/mips/trap.c#8 (text+ko) ==== @@ -905,10 +905,26 @@ addr = trapframe->pc; } break; +#ifdef CPU_CHERI + case T_C2E: + goto err; + break; + + case T_C2E + T_USER: + /* + * XXXRW: Eventually, do much, much more here. + * log_cheri_exception("C2E", trapframe); + */ + i = SIGPROT; + addr = trapframe->pc; + break; + +#else case T_C2E: case T_C2E + T_USER: goto err; break; +#endif case T_COP_UNUSABLE: cop = (trapframe->cause & MIPS_CR_COP_ERR) >> MIPS_CR_COP_ERR_SHIFT; #if defined(CPU_CHERI) && defined(DDB) ==== //depot/projects/ctsrd/cheribsd/src/sys/sys/signal.h#3 (text+ko) ==== @@ -112,6 +112,7 @@ #define SIGTHR 32 /* reserved by thread library. */ #define SIGLWP SIGTHR #define SIGLIBRT 33 /* reserved by real-time library. */ +#define SIGPROT 34 /* in-address space security exception. */ #endif #define SIGRTMIN 65