Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Apr 2014 08:12:34 GMT
From:      Dirk-Willem van Gulik <dirkx@webweaving.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/188715: int64 not handled right as arg on badsect(8), possible other issues lurking
Message-ID:  <201404170812.s3H8CYxd096189@cgiserv.freebsd.org>
Resent-Message-ID: <201404170820.s3H8K0Ps065827@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         188715
>Category:       bin
>Synopsis:       int64 not handled right as arg on badsect(8), possible other issues lurking
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 17 08:20:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Dirk-Willem van Gulik
>Release:        9.2-RELEASE-p3
>Organization:
Web Weaving
>Environment:
pikmeer.webweaving.org 9.2-RELEASE-p3 FreeBSD 9.2-RELEASE-p3 #0: Sat Jan 11 02:38:15 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Was trying to map out some bad blocks prior to temporarily read/empty 4 Tbyte volume using ‚badsect(8)’ - and returing it.

Was expecting to be able to put the sector # into badsect (e.g. 3432631424 from below FSCK output).

This gave me a bit of an odd:

	badsect: 3432631424: Result too large 

As the daddr_t seems to be a 64bit unsigned; I assumed that the:

			number = strtol(*argv, NULL, 0);

was some legacy culprint - and changed it to a strtoll as the daddr_t you are entering is an int 64. 

			number = strtoll(*argv, NULL, 0);

That gets it past that point; only to segv out on:

     cg = dtog(fs, fsbn);

	/usr/include/ufs/ffs/fs.h:#define	dtog(fs, d)	((d) / (fs)->fs_fpg)
	/usr/include/ufs/ffs/fs.h:#define	dtogd(fs, d)	((d) % (fs)->fs_fpg)

a bit later.  While fs is valid - it seems  fs->fs_fpg returns as ‚0’ — why is this ?  Is geom too new ? Or is badsect too old/retired ?

Dw.

aacd1: hard error cmd=read 4246326690-4246326721
.

fsck(8):...
THE FOLLOWING DISK SECTORS COULD NOT BE READ: 3432631424, 3432631425, 3432631426, 3432631427, 3432631428, 3432631429, 3432631430, 3432631431, 3432631432, 3432631433, 3432631434, 3432631435, 3432631436, 3432631437, 3432631438, 3432631439, 3432631440, 3432631441, 3432631442, 3432631443, 3432631444, 3432631445, 3432631446, 3432631447, 3432631448, 3432631449, 3432631450, 3432631451, 3432631452, 3432631453, 3432631454, 3432631455,


$sudo geom label list aacd0s1d
Geom name: aacd0s1d
Providers:
1. Name: ufsid/4a08af657f7e3930
Mediasize: 4544528384 (4.2G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 536903168
Mode: r0w0e0
secoffset: 0
offset: 0
seclength: 8876032
length: 4544528384
index: 0
Consumers:
1. Name: aacd0s1d
Mediasize: 4544528384 (4.2G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 536903168
Mode: r0w0e0
>How-To-Repeat:
Run badsect with a >32 bit number. Observe it giving a Result too large
>Fix:
See above strtoll change -- but that uncovers another odd issue.

>Release-Note:
>Audit-Trail:
>Unformatted:



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