From owner-freebsd-current@FreeBSD.ORG Wed Mar 9 02:54:45 2005 Return-Path: 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 DA82816A4CE for ; Wed, 9 Mar 2005 02:54:45 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.192]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47B4843D41 for ; Wed, 9 Mar 2005 02:54:45 +0000 (GMT) (envelope-from kjelderg@gmail.com) Received: by rproxy.gmail.com with SMTP id j1so60001rnf for ; Tue, 08 Mar 2005 18:54:44 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=BNuDz4SZy5Egcmixes1E8EXmzV8URt6tmzvmmQ3IoLep7vMvvHS1G2mkthd0hz9zENoYXgOKGXzeLn4Bhz/JP3ZQ34e+EyGhrmmPFTIDBKvsJypYZa3IjURk1iYHDfCV+znmT2NlLxlkEqc6JT3QLBcD55F0hyz+IQYUBJQd2wM= Received: by 10.38.181.32 with SMTP id d32mr387997rnf; Tue, 08 Mar 2005 18:54:44 -0800 (PST) Received: by 10.38.101.19 with HTTP; Tue, 8 Mar 2005 18:54:44 -0800 (PST) Message-ID: Date: Tue, 8 Mar 2005 20:54:44 -0600 From: Eric Kjeldergaard To: FreeBSD Current Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: a relatively major problem with ext2. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Eric Kjeldergaard List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2005 02:54:46 -0000 After a bit of discussion on the kde list regarding a problem I've been having with kreadconfig (which uses mmap), I've stumbled (largely directed by Michael Nottebrock) upon an ext2 bug. Michael wrote and posted the following code: #include #include #include #include #include #include #include int main(int argc, char ** argv) { int fd; struct stat sb; void * region; if ((fd = open(argv[1], O_RDONLY)) < 0) { perror("open"); return 1; } if (fstat(fd, &sb)) { perror("fstat"); return 1; } region = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (region == ((caddr_t) -1)) { perror("mmap"); return 1; } close(fd); if (write(1, region, sb.st_size) != sb.st_size) { perror("write"); return 1; } return 0; } Well, this code run on something mounted as an ext2 partition reliably kernel panics my FreeBSD-CURRENT box. Hopefully someone can direct me as to any information they would need to try to sort this out. The kernel panic is this (hand typed): Fatal trap 12: page fault while in kernel mode fault virtual address = 0x1c fault code = supervisor write, page not present instruction pointer = 0x8:0xc04d199d stack pointer = 0x10:0xe2428b0c frame pointer = 0x10:0xe2428b64 code segment = base 0x0, limit 0xfffff, type 0x1b = dpl 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 543 (truss) trap number = 12 In case anyone doesn't wish to sift through the kde mailing list looking for what the original problem was, it is this: When kreadconfig (recent versions) tries to access a file on my ext2-mounted $HOME, it gets an error trying to mmap. The error (discovered via truss) looks a bit like this: open("/root/.kde/share/config/kpersonalizerrc",0x0,0666) = 4 (0x4) fstat(4,0xbfbfe650) = 0 (0x0) fstat(4,0xbfbfe510) = 0 (0x0) mmap(0x0,125,(0x1)PROT_READ,(0x2)MAP_PRIVATE,4,0x0) ERR#22 'Invalid argument' And kreadconfig silently fails and reports the incorrect result. -- If I write a signature, my emails will appear more personalised.