From owner-freebsd-hackers Fri Dec 22 9:30:16 2000 From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 22 09:30:12 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from whizkidtech.net (r42.bfm.org [216.127.220.138]) by hub.freebsd.org (Postfix) with ESMTP id 1E3C137B400 for ; Fri, 22 Dec 2000 09:30:11 -0800 (PST) Received: (from adam@localhost) by whizkidtech.net (8.9.2/8.9.2) id LAA00255 for hackers@FreeBSD.org; Fri, 22 Dec 2000 11:29:07 -0600 (CST) (envelope-from adam) Date: Fri, 22 Dec 2000 11:28:36 -0600 From: "G. Adam Stanislav" To: hackers@FreeBSD.org Subject: A bug in mmap? Message-ID: <20001222112836.A239@whizkidtech.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i Organization: Whiz Kid Technomagic X-URL: http://www.whizkidtech.net/ X-Castle: http://www.redprince.net/ X-Special-Effects: http://www.FilmSFX.com/ X-Operating-System: FreeBSD whizkidtech.net 3.1-RELEASE FreeBSD 3.1-RELEASE Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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. Adam -- Apply standard disk lamer To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message