From owner-p4-projects@FreeBSD.ORG Sun Jun 7 19:48:16 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6565C1065673; Sun, 7 Jun 2009 19:48:16 +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 23A29106566C for ; Sun, 7 Jun 2009 19:48:16 +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 102DA8FC1B for ; Sun, 7 Jun 2009 19:48:16 +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.3/8.14.3) with ESMTP id n57JmFtS076457 for ; Sun, 7 Jun 2009 19:48:15 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n57JmFa0076455 for perforce@freebsd.org; Sun, 7 Jun 2009 19:48:15 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 7 Jun 2009 19:48:15 GMT Message-Id: <200906071948.n57JmFa0076455@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 163728 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: Sun, 07 Jun 2009 19:48:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=163728 Change 163728 by rwatson@rwatson_freebsd_capabilities on 2009/06/07 19:47:44 Only check for CAP_WRITE on mmap() if both PROT_WRITE is set *and* MAP_SHARED is set. For copy-on-write scenarios, it's fine to allow write access even for a read-only descriptor. Affected files ... .. //depot/projects/trustedbsd/capabilities/src/sys/vm/vm_mmap.c#12 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/sys/vm/vm_mmap.c#12 (text+ko) ==== @@ -310,8 +310,10 @@ rights = CAP_MMAP; if (prot & PROT_READ) rights |= CAP_READ; - if (prot & PROT_WRITE) - rights |= CAP_WRITE; + if ((flags & MAP_SHARED) != 0) { + if (prot & PROT_WRITE) + rights |= CAP_WRITE; + } if (prot & PROT_EXEC) rights |= CAP_MAPEXEC; if ((error = fget_mmap(td, uap->fd, rights, &cap_maxprot,