From owner-freebsd-bugs@FreeBSD.ORG Sun May 28 07:37:31 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02D6D16C1C4 for ; Sun, 28 May 2006 07:20:23 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7AC2F43D46 for ; Sun, 28 May 2006 07:20:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k4S7KMFm099761 for ; Sun, 28 May 2006 07:20:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k4S7KM45099759; Sun, 28 May 2006 07:20:22 GMT (envelope-from gnats) Date: Sun, 28 May 2006 07:20:22 GMT Message-Id: <200605280720.k4S7KM45099759@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Yar Tikhiy Cc: Subject: Re: bin/98005: loader corrupts other files when rewriting nextboot.conf X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Yar Tikhiy List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 May 2006 07:37:47 -0000 The following reply was made to PR bin/98005; it has been noted by GNATS. From: Yar Tikhiy To: Ian Dowse Cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: bin/98005: loader corrupts other files when rewriting nextboot.conf Date: Sun, 28 May 2006 11:03:49 +0400 On Sat, May 27, 2006 at 01:05:01PM +0100, Ian Dowse wrote: > In message <200605271037.k4RAbtYw063346@comp.chem.msu.su>, Yar Tikhiy writes: > > When nextboot is in effect, loader(8) writes the modified > > contents of the nextboot.conf file, or whatever nextboot_conf > > is set to, to an incorrect location on the disk. The > > location overwritten is in the block after the one actually > > belonging to the nextboot.conf file. > > > > This problem is likely to be caused by an off-by-one bug in > > the stand-alone FS access library used by loader(8). > > You could try the following (I haven't tested it), but it's pretty > obvious how the bug happened if you compare bd_write() with the > bd_read() function that it was copied from. Looks like the author > of bd_write() was more interested in writing a little song in the > comments than writing to the correct part of the disk ;-) Your patch seems to work, thanks! I'll give it more thorough testing today by using nextboot routinely. > The bug probably wasn't noticed originally because it only affected > the LBA access case. Indeed, my FreeBSD slice lies above the 1023rd cylinder. -- Yar