tech-userlevel archive

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

Re: disklabel(8) allows addressing non-existent space



apb@ wrote:

> On Fri, 30 Dec 2011, David Laight wrote:
> >Last time I looked the only thing the i386 'c' partition was used for
> >was to protect the labelsector.
> >It wasn't possible to access the disk through it!
> 
> On NetBSD/i386, if you mark the "c" partition as "unused" in 
> the disklabel, then you can't access the disk through the "c" 
> partition (you get ENXIO "Device not configured"), but if you mark 
> it "unknown" in the disklabel then you can access the disk.

Maybe he says about old i386/disksubr.c which had a magic number "2":
>>      int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR;
in bounds_check_with_label(), and I agree there was no particular
reason to have RAW_PART==3 to handle MBR partition.

Anyway, disklabel(8) has -F (regular file) option
and it's also used as a host tool (to create bootable image on
cross build hosts), so we need at least an option to ignore
"out of bounds" values, to create label sector without whole disk.
(liveimage doesn't have to include swap, for example)

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index