From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 22 19:42:26 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F5D616A4CE for ; Thu, 22 Apr 2004 19:42:26 -0700 (PDT) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D36F43D54 for ; Thu, 22 Apr 2004 19:42:26 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) i3N2gO7Z004350; Thu, 22 Apr 2004 19:42:24 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.9p2/8.12.9/Submit) id i3N2gOMg004349; Thu, 22 Apr 2004 19:42:24 -0700 (PDT) (envelope-from dillon) Date: Thu, 22 Apr 2004 19:42:24 -0700 (PDT) From: Matthew Dillon Message-Id: <200404230242.i3N2gOMg004349@apollo.backplane.com> To: Stephan Uphoff References: <200404230103.VAA18066@stups.com> cc: hackers@freebsd.org cc: Julian Elischer Subject: Re: how to flush out cache.? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2004 02:42:26 -0000 Ok... I've done some more testing. Ahh! I finally was able to reproduce the problem with PROT_READ, and I now see the code bit you were talking about. That's definitely a bug. Here's the test program that reproduces the problem. This is definitely a serious bug. -Matt /* * y.c */ #include #include #include #include #include int main(int ac, char **av) { int fd; char *ptr1; char *ptr2; fd = open("test.dat", O_RDWR|O_CREAT|O_TRUNC, 0666); ftruncate(fd, 4096); ptr1 = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); *ptr1 = 'A'; ptr2 = mmap(NULL, 4096, PROT_READ, MAP_SHARED, fd, 0); if (msync(ptr2, 4096, MS_INVALIDATE | MS_SYNC) < 0) perror("msync"); printf("contents of *ptr1 is %d\n", *ptr1); printf("contents of *ptr2 is %d\n", *ptr2); return(0); }