From owner-p4-projects@FreeBSD.ORG Thu Aug 21 23:33:12 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 888151065672; Thu, 21 Aug 2008 23:33:12 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CC30106566C for ; Thu, 21 Aug 2008 23:33:12 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3756E8FC18 for ; Thu, 21 Aug 2008 23:33:12 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7LNXCMX035781 for ; Thu, 21 Aug 2008 23:33:12 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7LNXCAS035779 for perforce@freebsd.org; Thu, 21 Aug 2008 23:33:12 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Thu, 21 Aug 2008 23:33:12 GMT Message-Id: <200808212333.m7LNXCAS035779@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 148066 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2008 23:33:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=148066 Change 148066 by rwatson@rwatson_freebsd_capabilities on 2008/08/21 23:32:57 Allow shm_open(2) in capability mode, but only with SHM_ANON objects. Affected files ... .. //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#9 edit .. //depot/projects/trustedbsd/capabilities/src/sys/kern/uipc_shm.c#4 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#9 (text+ko) ==== @@ -5,7 +5,7 @@ # - sys_exit() and close() are very important. # - Sorted alphabetically, please keep it that way. # -# $P4: //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#8 $ +# $P4: //depot/projects/trustedbsd/capabilities/src/sys/kern/capabilities.conf#9 $ # __acl_aclcheck_fd __acl_delete_fd @@ -261,9 +261,9 @@ # setuid # -# shm_open needs scoping (just anonymous memory). +# We allow shm_open(2), but only when used with anonymous objects. # -#shm_open +shm_open shutdown sigaction sigaltstack ==== //depot/projects/trustedbsd/capabilities/src/sys/kern/uipc_shm.c#4 (text+ko) ==== @@ -462,6 +462,14 @@ mode_t cmode; int fd, error; + /* + * shm_open(2) of anonymous objects is allowed in capability mode, + * but naming of globally scoped objects is not. + */ + if ((td->td_ucred->cr_flags & CRED_FLAG_CAPMODE) && + (uap->path != SHM_ANON)) + return (ENOSYS); + if ((uap->flags & O_ACCMODE) != O_RDONLY && (uap->flags & O_ACCMODE) != O_RDWR) return (EINVAL);