Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Oct 2002 00:15:37 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Brian Somers <brian@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/kern subr_disk.c
Message-ID:  <20021005235134.J12119-100000@gamplex.bde.org>
In-Reply-To: <200210051124.g95BOMk2092338@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 5 Oct 2002, Brian Somers wrote:

> brian       2002/10/05 04:24:22 PDT
>
>   Modified files:
>     sys/kern             subr_disk.c
>   Log:
>   If dsgetlabel() returns a label with a size of zero in diskdumpconf(),
>   treat it as an invalid partition.
>
>   This fixes a bug where ``dumpon <device>'' will configure the dump
>   device at a random offset on the disk if <device> isn't a valid
>   partition.

This seems to only unbreak the case where the partition size is 0.  At
least the i386 dumpsys() has no bounds checking at the partition level.
It clobbers sectors outside of the partition starting at the non-random
offset dumplo given by:

	dumplo = di->mediaoffset + di->mediasize - Maxmem * (off_t)PAGE_SIZE;
	dumplo -= sizeof kdh * 2;

except in the following cases:
- if di_mediasize is actually large enough to hold the data
  (di_mediasize >= Maxmem * (off_t)PAGE_SIZE + sizeof(kdh) * 2 +
       <space for metadata, e.g., LABELSECTOR sectors>)
- if di_mediasize is 0 (or just small), then dumplo is negative and the
  disk driver's or hardware's bounds checking (of physical sector numbers)
  should prevent problems.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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