NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/37656: fdisk segfault on invalid MBR entries on non-x86 geometry detection



On May 25,  6:20am, Eric Auge wrote:
} Martin Husemann wrote:
} > The following reply was made to PR bin/37656; it has been noted by GNATS.
} >
} > From: Martin Husemann <martin%duskware.de@localhost>
} > Subject: Re: bin/37656: fdisk segfault on invalid MBR entries on non-x86 
geometry detection
} > Date: Wed, 2 Jan 2008 11:21:24 +0100
} >
} >  On Wed, Jan 02, 2008 at 02:13:59AM -0800, John Nemeth wrote:
} >  >      Not sure how this is handled, but yes the MBR would be all 0s.
} >
} >  The MBR has a magic number at the end (see MBR_MAGIC_OFFSET and MBR_MAGIC
} >  in bootblock.h).

     The issue here is using the partition table to guess the disk
geometry.  Obviously, if there isn't a valid partition table you can't
do that.  BTW, I wrote code to do this 15 years ago.  At that time, PC
BIOSes didn't have an "auto" setting for detecting disks automatically,
so you had to manually tell it the size of the disk.  Usually if you
set the "type" to "47", it would let you enter the geometry manually.
My program told you what numbers to stick in there, so I called it
"type47".

} Can fdisk fail in writing this magic number ?

     Only if there is a serious bug.

} This is an fdisk generated MBR partitioning on the cobalt, all tests
} I've done were reporting this bad magic number.

     If that is the case, then it shouldn't have been using the
partition table to guess the disk geometry.

} But it now successfully boot, what the purpose of this "magic number" ?

     To let the BIOS know that it is a valid boot sector.  If the
number isn't there, then the machine shouldn't boot at all.

}-- End of excerpt from Eric Auge



Home | Main Index | Thread Index | Old Index