From owner-freebsd-stable@FreeBSD.ORG Tue Dec 20 09:49:08 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75A5E106567C; Tue, 20 Dec 2011 09:49:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id EBA1D8FC14; Tue, 20 Dec 2011 09:49:07 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBK9mXtJ033880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Dec 2011 11:48:33 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBK9mXTg071913; Tue, 20 Dec 2011 11:48:33 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBK9mXe0071912; Tue, 20 Dec 2011 11:48:33 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Dec 2011 11:48:33 +0200 From: Kostik Belousov To: Peter Jeremy , pho@freebsd.org Message-ID: <20111220094832.GL50300@deviant.kiev.zoral.com.ua> References: <4EECFD6A.2030905@xs4all.nl> <2E07A04E-0FBF-47BE-96E7-F615FE78056E@gromit.dlib.vt.edu> <4EEFAC55.6050507@xs4all.nl> <20111219225143.GD2391@server.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="e5cjMM5jrdcddfcl" Content-Disposition: inline In-Reply-To: <20111219225143.GD2391@server.vk2pj.dyndns.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Michiel Boland , freebsd-stable@freebsd.org Subject: Re: fsck_ufs out of swapspace X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2011 09:49:08 -0000 --e5cjMM5jrdcddfcl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 20, 2011 at 09:51:43AM +1100, Peter Jeremy wrote: > On 2011-Dec-19 22:27:49 +0100, Michiel Boland wrote: > >Problem solved - it was indeed an endian thing. > >The problem is that fsck uses a real_dev_bsize variable that is declared= long,=20 > >but the DIOCGSECTORSIZE ioctl takes an u_int argument. >=20 > 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. >=20 > >A PR has been submitted. >=20 > 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 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -268,7 +268,7 @@ char snapname[BUFSIZ]; /* when doing snapshots, the nam= e of the file */ char *cdevname; /* name of device being checked */ long dev_bsize; /* computed value of DEV_BSIZE */ long secsize; /* actual disk sector size */ -long real_dev_bsize; +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 --- a/sbin/fsck_ffs/suj.c +++ b/sbin/fsck_ffs/suj.c @@ -206,7 +206,7 @@ opendisk(const char *devnam) &real_dev_bsize) =3D=3D -1) real_dev_bsize =3D secsize; if (debug) - printf("dev_bsize %ld\n", real_dev_bsize); + printf("dev_bsize %u\n", real_dev_bsize); } =20 /* --e5cjMM5jrdcddfcl Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7wWe8ACgkQC3+MBN1Mb4jJ4gCePXF1kr1YmEdMhr3YXCoU4a49 CXUAoOxV0l9PaKXGTY1LOvSGmpfMC/J4 =5Ox1 -----END PGP SIGNATURE----- --e5cjMM5jrdcddfcl--