Subject: Re: Fwd: Re: port-i386/1238: Reading past end of IDE disk causes EIO, not EOF
To: D'Arcy J.M. Cain <>
From: Manuel Bouyer <>
List: current-users
Date: 03/08/2003 18:17:06
On Sat, Mar 08, 2003 at 10:51:25AM -0500, D'Arcy J.M. Cain wrote:
> I am forwarding this message to the gnats list to current-users to see if we 
> can get some wider discussion on the subject.  This is another one of those 
> dusty PRs that I am hoping to badger people into working on.
> Note that the patches suggested here have not even been pulled up to release 
> as far as I can tell.  It has been suggested that the problem with the fix is 
> that it can prevent a new disklabel from being written to disks in some 
> circumstances.  I'm not clear on what those circumstances are.

If the disklabel read from disk has a too small size for the raw partition
(which can happens if the disk already contain data which are improperly
interpreted as a disklabel), a new disklabel can't be written to disk,
bound_check_with_label() will deny it.
In such a case a workaround is to update the in-core disklabel before writing
it to disk. If we think this is enouth we need to make sure all our
standart disklabel-writing tools (disklabel, sunlabel, sysinst, etc ...)
do it in 2 step: update the in-core disklabel before updating the on-disk
Another way of dealing with the problem is to change all the MD readdisklabel()
to check, in addition to the exising checks (checksums, etc) that the
raw partition makes sense (starts at 0, and is large enouth to hold the
disklabel sectors).

I prefer the second way, as it makes the system more robust in face of
new disks added to the system which already contains random data.

Manuel Bouyer <>
     NetBSD: 24 ans d'experience feront toujours la difference