From owner-freebsd-current@FreeBSD.ORG Sun Jul 31 20:19:04 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 E766116A41F for ; Sun, 31 Jul 2005 20:19:04 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.93]) by mx1.FreeBSD.org (Postfix) with ESMTP id F2CE143D49 for ; Sun, 31 Jul 2005 20:19:03 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-a053.otenet.gr [212.205.215.53]) by aiolos.otenet.gr (8.13.4/8.13.4/Debian-1) with ESMTP id j6VKJ1lf030842; Sun, 31 Jul 2005 23:19:01 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.4/8.13.4) with ESMTP id j6VKJ0RR001227; Sun, 31 Jul 2005 23:19:00 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.13.4/8.13.4/Submit) id j6VKIwOW001226; Sun, 31 Jul 2005 23:18:58 +0300 (EEST) (envelope-from keramida@freebsd.org) Date: Sun, 31 Jul 2005 23:18:58 +0300 From: Giorgos Keramidas To: Joseph Koshy Message-ID: <20050731201858.GC1052@gothmog.gr> References: <20050731141801.GA49300@gothmog.gr> <84dead7205073108564f71f1ab@mail.gmail.com> <20050731160853.GC49839@gothmog.gr> <84dead720507311115290f0140@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <84dead720507311115290f0140@mail.gmail.com> 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: Sun, 31 Jul 2005 20:19:05 -0000 On 2005-07-31 23:45, Joseph Koshy wrote: > gk> That's something I didn't test. No, the 'extra' data > gk> disappears. > > So the 'extra' data isn't reaching the FS and is probably > being served up from a cached VM data the second time your > test program ran. > > This is still a bug though: the mmap(2) manual page > says: > ... > If len is not a multiple of > the page-size, the mapped region may extend past the > specified range. Any such extension beyond the end of the > mapped object will be zero-filled. > ... > > We are clearly not doing the zero-filling. The mapping is allocated as MAP_SHARED, so when I unmap() it from a process that has attached to the specific object/file/whatever that is, it shouldn't be zeroed. The bug seems to be elsewhere, namely to the fact that the filesystem code never realizes the file has changed size after I use mmap() to map a region beyond its current size and write past its current end.