From owner-freebsd-current@FreeBSD.ORG Mon Aug 1 01:32:14 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C94DD16A41F; Mon, 1 Aug 2005 01:32:14 +0000 (GMT) (envelope-from wollman@khavrinen.csail.mit.edu) Received: from khavrinen.csail.mit.edu (khavrinen.csail.mit.edu [128.30.28.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A9C543D45; Mon, 1 Aug 2005 01:32:14 +0000 (GMT) (envelope-from wollman@khavrinen.csail.mit.edu) Received: from khavrinen.csail.mit.edu (localhost.csail.mit.edu [127.0.0.1]) by khavrinen.csail.mit.edu (8.13.1/8.13.1) with ESMTP id j711WCA2080870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK CN=khavrinen.csail.mit.edu issuer=Client+20CA); Sun, 31 Jul 2005 21:32:12 -0400 (EDT) (envelope-from wollman@khavrinen.csail.mit.edu) Received: (from wollman@localhost) by khavrinen.csail.mit.edu (8.13.1/8.13.1/Submit) id j711WCgo080867; Sun, 31 Jul 2005 21:32:12 -0400 (EDT) (envelope-from wollman) From: Garrett Wollman MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17133.31644.343077.241748@khavrinen.csail.mit.edu> Date: Sun, 31 Jul 2005 21:32:12 -0400 To: Giorgos Keramidas In-Reply-To: <20050731224601.GA2024@gothmog.gr> References: <20050731141801.GA49300@gothmog.gr> <84dead7205073108564f71f1ab@mail.gmail.com> <20050731160853.GC49839@gothmog.gr> <84dead720507311115290f0140@mail.gmail.com> <20050731201858.GC1052@gothmog.gr> <17133.21281.703540.383144@khavrinen.csail.mit.edu> <20050731224601.GA2024@gothmog.gr> X-Mailer: VM 7.17 under 21.4 (patch 17) "Jumbo Shrimp" XEmacs Lucid X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-1.6 (khavrinen.csail.mit.edu [127.0.0.1]); Sun, 31 Jul 2005 21:32:13 -0400 (EDT) X-Spam-Status: No, score=0.0 required=5.0 tests=none version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on khavrinen.csail.mit.edu X-Mailman-Approved-At: Mon, 01 Aug 2005 12:01:06 +0000 Cc: freebsd-current@freebsd.org Subject: Re: mmap bug? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2005 01:32:14 -0000 < said: > Is the fact that the data written to the mapped region visible after the > close (by mapping the same region) expected too? No, that's a bug. (It's not a particularly surprising one, although I'm no VM expert and I have no idea how difficult it would be to fix.) The problem is that the VM system has no efficient way of telling that you modified the part of the page that's after the end of the file, so when you close the file, the dirty but only partially valid page is cached. Because you did a MAP_SHARED, mmap() can't use an anonymous page -- it has to use the actual page from the file. If the page isn't in cache, it will correctly zero-fill the parts beyond the end of the file, but it doesn't appear to do this for cached pages on 0->1 refcount transitions. -GAWollman