[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
system/3640: installboot dumps core when given a non numeric argument to -s parameter
- To: gnats@openbsd.org
- Subject: system/3640: installboot dumps core when given a non numeric argument to -s parameter
- From: lsalle@taciturne.net
- Date: Tue, 20 Jan 2004 12:10:32 +0100 (CET)
- Resent-Date: Tue, 20 Jan 2004 04:25:03 -0700 (MST)
- Resent-From: gnats@cvs.openbsd.org (GNATS Filer)
- Resent-Message-Id: <200401201125.i0KBP3Tn021721@cvs.openbsd.org>
- Resent-Reply-To: gnats@cvs.openbsd.org, lsalle@taciturne.net
- Resent-To: bugs@cvs.openbsd.org
>Number: 3640
>Category: system
>Synopsis: installboot dumps core when given a non numeric argument to -s parameter
>Confidential: yes
>Severity: non-critical
>Priority: low
>Responsible: bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 20 11:20:02 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: staff
>Release: OPENBSD_3_4
>Organization:
net
>Environment:
System : OpenBSD 3.4
Architecture: OpenBSD.i386
Machine : i386
>Description:
In the following shell script, a non-numeric string follows the -s argument to installboot, resulting in a core dump (floating point exception).
------
#!/bin/sh
CYLINDERS=5
TRACKS_PER_CYLINDER=8
SECTORS_PER_TRACK=32
BYTES_PER_SECTOR=512
IMAGE=$0.`date +%Y%m%d%H%M%S`.img
DEVICE=svnd0
DIST_ROOT=/usr/dist
IMAGE_DISKLABEL=$IMAGE.disklabel
IMAGE_MOUNTPOINT=$IMAGE.mnt
SECTORS_PER_CYLINDER=$(($SECTORS_PER_TRACK * $TRACKS_PER_CYLINDER))
TOTAL_SECTORS=$(($CYLINDERS * $SECTORS_PER_CYLINDER))
dd if=/dev/zero of=$IMAGE bs=$BYTES_PER_SECTOR count=$TOTAL_SECTORS
sudo vnconfig -u $DEVICE
sudo vnconfig -v $DEVICE $IMAGE
sudo fdisk -e -c $CYLINDERS -h $TRACKS_PER_CYLINDER -s $SECTORS_PER_TRACK -f $DISTROOT/usr/mdec/mb
r $DEVICE << __EOC
reinit
update
write
quit
__EOC
AOFFSET=$SECTORS_PER_CYLINDER
ASIZE=$(($TOTAL_SECTORS - $AOFFSET))
cat > $IMAGE_DISKLABEL << __EOF
type: SCSI
disk: vnd device
label: fictitious
flags:
rpm:3600
bytes/sector: $BYTES_PER_SECTOR
sectors/track: $SECTORS_PER_TRACK
tracks/cylinder: $TRACKS_PER_CYLINDER
sectors/cylinder: $SECTORS_PER_CYLINDER
cylinders: $CYLINDERS
total sectors: $TOTAL_SECTORS
16 partitions:
a: $ASIZE $AOFFSET 4.2BSD 2048 16384 1568
c: $TOTAL_SECTORS 0 unused
__EOF
sudo disklabel -R $DEVICE $IMAGE_DISKLABEL
rm $IMAGE_DISKLABEL
sudo newfs -S $BYTES_PER_SECTOR -u $SECTORS_PER_TRACK -z $TRACKS_PER_CYLINDER /dev/r${DEVICE}a
mkdir $IMAGE_MOUNTPOINT
sudo mount /dev/${DEVICE}a $IMAGE_MOUNTPOINT
sudo cp /usr/mdec/boot $IMAGE_MOUNTPOINT
sudo /usr/mdec/installboot -v -s XXXX -h $TRACKS_PER_CYLINDER $IMAGE_MOUNTPOINT/boot /usr/mdec/bio
sboot $DEVICE
sudo umount $IMAGE_MOUNTPOINT
rmdir $IMAGE_MOUNTPOINT
sudo vnconfig -u $DEVICE
------
>How-To-Repeat:
Run the given shell script.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: