Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 1995 03:13:12 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        jkh@time.cdrom.com, phk@freebsd.org
Cc:        hackers@freebsd.org
Subject:   Re: sysinstall considered harmful!
Message-ID:  <199512111613.DAA16770@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>The code fragment from /usr/src/release/sysinstall/disks.c that
>writes disk labels out looks like this:


>    for (i = 0; devs[i]; i++) {
>        Chunk *c1;
>        Disk *d = (Disk *)devs[i]->private;

>        if (!devs[i]->enabled)
>            continue;

>        Set_Boot_Blocks(d, boot1, boot2);
>        msgNotify("Writing partition information to drive %s", d->name);
>        if (Write_Disk(d)) {
>            dialog_clear();
>            msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
>            return RET_FAIL;
>        }

>If devs[i]->enabled is not set, which I've proven to be the case for
>all disks that weren't selected, it will skip the disk, leading me to

I tried installing on fd1.  The message

	"Writing partition information to drive 0"

was printed and the MBR was clobbered (from all 0's to all 0's except
for 0xaa55 at the end) so devs[0]->enabled must have been set.

sysinstall is challenged by installing on fd1.  I had to set things up
specially:

	compile fd.c with options TEST_LABELLING
	mknod the relevant devices
	add "fd" to the list of disks in libdisks/disk.c (sysinstall
	    run as non-root says that I don't have any disks except
	    floppies.  It apparently doesn't distinguish EACCESS
	    from ENXIO)

Then the partition table part of sysinstall works well and the labelling
part not so well (it won't allow creation of partitions smaller than 1MB).
The bug can be reproduced something like this:

	clear the fd MBR's and labels (dd if=/dev/zero of=/dev/rfd0
	    count=2 etc.)
	Create a default slice on fd1
	Create a default partition on fd1 (fd1s1a / 1MB UFS Y)
	Write

The equivalent using vn instead of fd should fail in the same way.
Floppies are better for debugging without a debugger because they are
slow and have separate access LEDs.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512111613.DAA16770>