From owner-freebsd-hackers Fri Dec 22 9:35:20 2000 From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 22 09:35:19 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 68AC937B400 for ; Fri, 22 Dec 2000 09:35:15 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eBMHZDF15025; Fri, 22 Dec 2000 09:35:13 -0800 (PST) Date: Fri, 22 Dec 2000 09:35:13 -0800 From: Alfred Perlstein To: "G. Adam Stanislav" Cc: hackers@FreeBSD.ORG Subject: Re: A bug in mmap? Message-ID: <20001222093512.L19572@fw.wintelcom.net> References: <20001222112836.A239@whizkidtech.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001222112836.A239@whizkidtech.net>; from adam@whizkidtech.net on Fri, Dec 22, 2000 at 11:28:36AM -0600 Sender: bright@fw.wintelcom.net Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * G. Adam Stanislav [001222 09:30] wrote: > I think I have just discovered a bug... (FreeBSD 3.1). > > Here is the scenario: The program (I have written) opens a file as O_RDWR, > then uses mmap with PROT_READ | PROT_WRITE and MAP_SHARED. It works on > the data, optionally reduces the file size, then unmaps and closes it. > > Everything works fine as long as the file is on a native FreeBSD disk. > But if it is on a Windows formatted hard drive mounted under FreeBSD, > *sometimes* the file ends up filled with NULs. > > Could it be mmap may get confused by a Windows formated drive? It does NOT > return an error, but it fills the mapped area with zeros. It overwrites > the contents of the file with zeros, but does not change the directory > information (i.e., the time of the last access, and such). > > It never happens on a FreeBSD drive, only on a Windows formated drive, > which makes it rather spooky. Most likely a result of a bug in the msdosfs code, perhaps you can help track it down? I don't use msdosfs. :( -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message