From owner-p4-projects@FreeBSD.ORG Fri Sep 12 18:42:41 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E6CD177C; Fri, 12 Sep 2014 18:42:40 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9B3A77A for ; Fri, 12 Sep 2014 18:42:40 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9525F960 for ; Fri, 12 Sep 2014 18:42:40 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.9/8.14.9) with ESMTP id s8CIgelT032070 for ; Fri, 12 Sep 2014 18:42:40 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.9/8.14.9/Submit) id s8CIgeik032067 for perforce@freebsd.org; Fri, 12 Sep 2014 18:42:40 GMT (envelope-from jhb@freebsd.org) Date: Fri, 12 Sep 2014 18:42:40 GMT Message-Id: <201409121842.s8CIgeik032067@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 1200166 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.18-1 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2014 18:42:41 -0000 http://p4web.freebsd.org/@@1200166?ac=10 Change 1200166 by jhb@jhb_ralph on 2014/09/12 18:42:05 Tweaks. Affected files ... .. //depot/projects/smpng/sys/vm/vm_mmap.c#108 edit Differences ... ==== //depot/projects/smpng/sys/vm/vm_mmap.c#108 (text+ko) ==== @@ -203,17 +203,14 @@ struct vnode *vp; vm_offset_t addr; vm_size_t size, pageoff; - vm_prot_t cap_maxprot, prot, maxprot; + vm_prot_t cap_maxprot, maxprot; void *handle; objtype_t handle_type; - int align, error, flags; + int align, error, flags, prot; off_t pos; struct vmspace *vms = td->td_proc->p_vmspace; cap_rights_t rights; - if ((uap->prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_NONE)) != 0) - return (EINVAL); - addr = (vm_offset_t) uap->addr; size = uap->len; prot = uap->prot; @@ -252,6 +249,9 @@ if ((flags & (MAP_ANON | MAP_SHARED | MAP_PRIVATE)) == 0 || (flags & (MAP_SHARED | MAP_PRIVATE)) == (MAP_SHARED | MAP_PRIVATE)) return (EINVAL); + if (prot != PROT_NONE && + (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0) + return (EINVAL); /* * Align the file position to a page boundary, @@ -421,6 +421,8 @@ map: td->td_fpop = fp; maxprot &= cap_maxprot; + + /* This relies on VM_PROT_* matching PROT_*. */ error = vm_mmap(&vms->vm_map, &addr, size, prot, maxprot, flags, handle_type, handle, pos); td->td_fpop = NULL;