From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 28 16:33:00 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F34D5106564A for ; Tue, 28 Jul 2009 16:32:59 +0000 (UTC) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.ntu-kpi.kiev.ua (comsys.ntu-kpi.kiev.ua [77.47.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id 6C3A98FC0A for ; Tue, 28 Jul 2009 16:32:56 +0000 (UTC) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from pm513-1.comsys.ntu-kpi.kiev.ua (pm513-1.comsys.ntu-kpi.kiev.ua [10.18.52.101]) (authenticated bits=0) by comsys.ntu-kpi.kiev.ua (8.13.7/8.13.7) with ESMTP id n6SFtqYD080117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 28 Jul 2009 18:55:52 +0300 (EEST) Received: by pm513-1.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1001) id 7092F1CC39; Tue, 28 Jul 2009 18:55:38 +0300 (EEST) Date: Tue, 28 Jul 2009 18:55:38 +0300 From: Andrey Simonenko To: Andrew Brampton Message-ID: <20090728155538.GA77306@pm513-1.comsys.ntu-kpi.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: ClamAV version 0.93.1, clamav-milter version 0.93.1 on comsys.ntu-kpi.kiev.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.4 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on comsys.ntu-kpi.kiev.ua Cc: freebsd-hackers@freebsd.org Subject: Re: vm_map_protect / pmap_protect Can't lower protection X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2009 16:33:00 -0000 Hello Andrew, On Mon, Jul 20, 2009 at 04:14:02PM +0100, Andrew Brampton wrote: > However, memguard_unguard doesn't work correctly. It first calls > vm_map_protect with a read-write flag. > vm_map_protect correctly updates the vm_map_entry, and then calls > pmap_protect to set the actual pte. > pmap_protect is lazy and notices that we are reducing the protection > on the page and therefore does nothing. It assumes that later that a > page fault will occur, call vm_fault, and then fix up the pte then. As I remember, pmap_protect() is used for removing permissions, it cannot be used (even in initial versions of pmap code) for lowering permissions. pmap_enter() can be used to lower permissions, this is even written in its comments.