Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jul 1998 14:37:01 -0700 (PDT)
From:      Matt Dillon <dillon@best.net>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/7418: Critical file corruption in write() based append when file is mmap'd
Message-ID:  <199807272137.OAA23112@flea.best.net>

next in thread | raw e-mail | index | archive | help

>Number:         7418
>Category:       kern
>Synopsis:       File corruption occurs when shared+ro mmap'd file is appended to via write()
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 27 14:40:00 PDT 1998
>Last-Modified:
>Originator:     Matt Dillon
>Organization:
Best Internet Communications, Inc.
>Release:        FreeBSD 2.2.6-STABLE i386
>Environment:

	FreeBSD-current
	FreeBSD-stable
	heavily loaded mmap & file-writing environment
	CCD striped disk partition.

>Description:

	This has been noticed on a number of FreeBSD-current and 
	FreeBSD-stable machines running news software.

	The problem occurs when one process is appending to a file
	via write() while another is doing a shared+ro mmap()'ing of
	the file.  The problem occurs often, but I cannot deterministically
	reproduce it.

	I was able to ktrace the writing process.  The ktrace is included.
	Note that the writing process has been found to be writing to
	the file properly.  The reading process mmap's the file in real
	time... that is, it is accessing it's mmap simultanious with the
	writing process writing to the file.  The hex dump of the file is
	shown below...  the corrupted area is full of 00 00 00 00's.

	The corruption generally extends to the end of a page boundry.

	If you look at the writing process, you will notice that it is
	simply appending articles to the file.  There is no concept of
	a page boundry.

	There is a serious issue here that needs to be resolved.

0002.1960  0a 20 20 20 20 20 73 6f 6d 65 68 6f 77 20 61 20  .     somehow a 
0002.1970  73 61 70 6c 69 6e 67 0a 20 20 20 20 20 6f 6e 20  sapling.     on 
0002.1980  74 68 69 73 20 62 65 64 72 6f 63 6b 20 6f 66 20  this bedrock of 
0002.1990  61 20 74 6f 6e 67 75 65 0a 0a 20 20 20 20 20 69  a tongue..     i
0002.19a0  74 20 77 69 6c 6c 20 62 65 0a 20 20 20 20 20 61  t will be.     a
0002.19b0  73 20 79 6f 75 20 68 61 76 65 20 77 72 69 74 74  s you have writt
0002.19c0  65 6e 0a 20 20 20 20 20 61 73 20 65 78 61 63 74  en.     as exact
0002.19d0  20 61 6e 64 20 6c 6f 76 65 6c 79 0a 20 20 20 20   and lovely.    
0002.19e0  20 61 73 20 61 6e 79 20 66 72 75 69 74 20 62 65   as any fruit be
0002.19f0  61 72 69 6e 67 20 74 68 69 6e 67 0a 20 20 20 20  aring thing.    
0002.1a00  20 74 68 61 74 20 77 69 6c 6c 20 65 76 65 72 20   that will ever 
0002.1a10  6d 61 6b 65 20 61 20 73 6f 75 6e 64 0a 0a 0a 37  make a sound...7
0002.1a20  2d 32 37 2d 39 38 0a 64 63 6c 65 0a 0a 2d 2d 2d  -27-98.dcle..---
0002.1a30  2d 2d 3d 3d 20 50 6f 73 74 65 64 20 76 69 61 20  --== Posted via 
0002.1a40  44 65 6a 61 20 4e 65 77 73 2c 20 54 68 65 20 4c  Deja News, The L
0002.1a50  65 61 64 65 72 20 69 6e 20 49 6e 74 65 72 6e 65  eader in Interne
0002.1a60  74 20 44 69 73 63 75 73 73 69 6f 6e 20 3d 3d 2d  t Discussion ==-
0002.1a70  2d 2d 2d 2d 0a 68 74 74 70 3a 2f 2f 77 77 77 2e  ----.http://www.
0002.1a80  64 65 6a 61 6e 65 77 73 2e 63 6f 6d 2f 72 67 5f  dejanews.com/rg_
0002.1a90  6d 6b 67 72 70 2e 78 70 20 20 20 43 72 65 61 74  mkgrp.xp   Creat
0002.1aa0  65 20 59 6f 75 72 20 4f 77 6e 20 46 72 65 65 20  e Your Own Free 
0002.1ab0  4d 65 6d 62 65 72 20 46 6f 72 75 6d 0a 00 00 00  Member Forum....
0002.1ac0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1ad0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1ae0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1af0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1b00  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1b10  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1b20  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
...
0002.1f70  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1f80  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1f90  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1fa0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1fb0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1fc0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1fd0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1fe0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.1ff0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0002.2000  69 74 64 2e 75 6d 69 63 68 2e 65 64 75 21 6e 65  itd.umich.edu!ne
0002.2010  77 73 2d 70 65 65 72 2e 67 69 70 2e 6e 65 74 21  ws-peer.gip.net!
0002.2020  6e 65 77 73 2e 67 73 6c 2e 6e 65 74 21 67 69 70  news.gsl.net!gip
0002.2030  2e 6e 65 74 21 6e 65 77 73 66 65 65 64 2e 69 6e  .net!newsfeed.in
0002.2040  74 65 72 6e 65 74 6d 63 69 2e 63 6f 6d 21 32 30  ternetmci.com!20
0002.2050  34 2e 32 33 38 2e 31 32 30 2e 31 33 30 21 6e 65  4.238.120.130!ne


  8240 diablo   0.000120 CALL  lseek(0xe,0,0x21abe,0,0)
  8240 diablo   0.000041 RET   lseek 137918/0x21abe
  8240 diablo   0.000032 CALL  write(0xe,0x2278c020,0x283)
  8240 diablo   0.000095 GIO   fd 14 wrote 643 bytes
       "Path: news3.best.com!news1.best.com!feed1.news.erols.com!howland.erols.net!newsfeed.internetmci.com!204.238.120.130!news-feeds.jump.net!nntp2.dejanews.com!nnrp1.dejanews.com!not\
        -for-mail
        From: parsrise@my-dejanews.com
        Newsgroups: ott.business.ads
        Subject: Ottawa, Centretown Apartments For Rent
        Date: Mon, 27 Jul 1998 20:48:59 GMT
        Organization: Deja News - The Leader in Internet Discussion
        Lines: 29
        Message-ID: <6pip3s$f5b$1@nnrp1.dejanews.com>
        NNTP-Posting-Host: 192.58.194.87
        X-Article-Creation-Date: Mon Jul 27 20:48:59 1998 GMT
        X-Http-User-Agent: Mozilla/3.04 (X11; I; HP-UX A.09.03 9000/712)
        Xref: news3.best.com ott.business.ads:12900
       "
  8240 diablo   0.000038 RET   write 643/0x283
  8240 diablo   0.000065 CALL  lseek(0xe,0,0,0,0x1)
  8240 diablo   0.000032 RET   lseek 138561/0x21d41
  8240 diablo   0.000030 CALL  write(0xe,0x2278c020,0x291)
  8240 diablo   0.000060 GIO   fd 14 wrote 657 bytes
   ...
  8240 diablo   0.000046 CALL  lseek(0xe,0,0,0,0x1)
  8240 diablo   0.000033 RET   lseek 139218/0x21fd2
   ...

139264 is the 4K boundry



  8240 diablo   0.000054 CALL  lseek(0xe,0,0x21fd2,0,0)
  8240 diablo   0.000037 RET   lseek 139218/0x21fd2
  8240 diablo   0.000035 CALL  write(0xe,0x2278c020,0x2d9)
  8240 diablo   0.000408 GIO   fd 14 wrote 729 bytes
       "Path: news3.best.com!news1.best.com!newsxfer3.itd.umich.edu!news-peer.gip.net!news.gsl.net!gip.net!newsfeed.internetmci.com!204.238.120.130!news-feeds.jump.net!nntp2.dejanews.co\
        m!nnrp1.dejanews.com!not-for-mail
        From: elleinad@my-dejanews.com
        Newsgroups: rec.arts.disney.parks
        Subject: Re: Planning 4 days at WDW
        Date: Mon, 27 Jul 1998 20:52:41 GMT
        Organization: Deja News - The Leader in Internet Discussion
        Lines: 30
        Message-ID: <6pipaq$f81$1@nnrp1.dejanews.com>
        References: <1998072618171400.OAA06477@ladder03.news.aol.com>
        NNTP-Posting-Host: 204.189.84.62
        X-Article-Creation-Date: Mon Jul 27 20:52:41 1998 GMT
        X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)
        Xref: news3.best.com rec.arts.disney.parks:187617
       "
  8240 diablo   0.000056 RET   write 729/0x2d9

  8240 diablo   0.000052 CALL  lseek(0xe,0,0,0,0x1)
  8240 diablo   0.000032 RET   lseek 139947/0x222ab
  8240 diablo   0.000030 CALL  write(0xe,0x2278c020,0x537)
  8240 diablo   0.000066 GIO   fd 14 wrote 1335 bytes
       "
        Well, I'm 13, and these are some of my favorites:
        
        Magic Kingdom: Space Mountain, Alien Encounter, Splash Mountain, Big Thunder
        Mountain Railroad, the Barnstormer (back seat ONLY!) ;-) Epcot: Honey, I
        Shrunk the Audience, the Image Works, Innoventions, Wonders of Life, and the
        ride at Norway. MGM Studios: Tower of Terror, Star Tours, Superstar
        Television, 50's Prime Time Cafe'. (It's an attraction in itself!) Animal
        Kingdom: Kilimanjaro Safaris, Countdown to Extinction, Legend of the Lion
        King show, Tough to Be A Bug. Water Parks: SUMMIT PLUMMET, Slush Gusher,
        Downhill Double Dipper, and the fun chute slide (kind of off to itself) at
        Ski Patrol Training Camp.
        
        Have fun!
        
        In article <1998072618171400.OAA06477@ladder03.news.aol.com>,
          megps@aol.com (MegPS) wrote:
        > We are headed to WDW on sunday for 4 days, We will be staying at CS, and we
        > have passes for all of the parks and water parks. We have two girls, 14 and16,
        > who will probably be on their own for much of the time, can you suggest some
        > things that they might want to do while they're there? Thanks much.
        >
        
        
        --
                           Danielle
                    Danielle@searnet.com
        TDC Keeper of Pegasus, Summit Plummet,
        
        -----== Posted via Deja News, The Leader in Internet Discussion ==-----
        http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
        \0"
  8240 diablo   0.000046 RET   write 1335/0x537
  8240 diablo   0.000040 CALL  lseek(0xe,0,0,0,0x1)
  8240 diablo   0.000029 RET   lseek 141282/0x227e2


>How-To-Repeat:

	I can get it to occur quite often but I cannot get it to repeat
	in a deterministic fashion.  I believe the heavy load on the
	machine is making the bug more visible.

>Fix:
	

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807272137.OAA23112>