fsck_ufs out of swapspace
kostikbel at gmail.com
Tue Dec 20 09:49:08 UTC 2011
On Tue, Dec 20, 2011 at 09:51:43AM +1100, Peter Jeremy wrote:
> On 2011-Dec-19 22:27:49 +0100, Michiel Boland <boland37 at xs4all.nl> wrote:
> >Problem solved - it was indeed an endian thing.
> >The problem is that fsck uses a real_dev_bsize variable that is declared long,
> >but the DIOCGSECTORSIZE ioctl takes an u_int argument.
> To be accurate, this isn't an endian problem, it's a general problem
> of passing a pointer to an incorrectly sized object. The bug is
> masked on amd64 & iA64 because real_dev_bsize is statically allocated
> and therefore initialised to zero. This means the failure to assign
> the top 32 bits in the ioctl doesn't affect the final result.
> >A PR has been submitted.
> sparc64/163460 for the record. Thank you for tracking that down.
The easier fix is to change the type of real_dev_bsize. I used long only
because other n variables keeping the sector size are long, but there
is no much reason to use long there.
Peter, would you, please retest the +J on non-512 byte sectors, with the
patch attached ?
diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h
index 8091d0f..4e30a7e 100644
@@ -268,7 +268,7 @@ char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */
char *cdevname; /* name of device being checked */
long dev_bsize; /* computed value of DEV_BSIZE */
long secsize; /* actual disk sector size */
+u_int real_dev_bsize; /* actual disk sector size, not overriden */
char nflag; /* assume a no response */
char yflag; /* assume a yes response */
int bkgrdflag; /* use a snapshot to run on an active system */
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index ec8b5ab..b784519 100644
@@ -206,7 +206,7 @@ opendisk(const char *devnam)
&real_dev_bsize) == -1)
real_dev_bsize = secsize;
- printf("dev_bsize %ld\n", real_dev_bsize);
+ printf("dev_bsize %u\n", real_dev_bsize);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20111220/88714c58/attachment.pgp
More information about the freebsd-stable