From setantae@submonkey.net  Mon Oct  1 08:18:52 2001
Return-Path: <setantae@submonkey.net>
Received: from relay3-gui.server.ntli.net (relay3-gui.server.ntli.net [194.168.4.200])
	by hub.freebsd.org (Postfix) with ESMTP id 8949537B40E
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  1 Oct 2001 08:15:16 -0700 (PDT)
Received: from pc2-card3-0-cust79.cdf.cable.ntl.com
	([213.107.2.79] helo=rhadamanth.private.submonkey.net ident=exim)
	by relay3-gui.server.ntli.net with esmtp (Exim 3.03 #2)
	id 15o4mp-0002O8-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 01 Oct 2001 16:15:15 +0100
Received: from setantae by rhadamanth.private.submonkey.net with local (Exim 3.33 #1)
	id 15o4kt-0007hD-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 01 Oct 2001 16:13:15 +0100
Message-Id: <E15o4kt-0007hD-00@rhadamanth.private.submonkey.net>
Date: Mon, 01 Oct 2001 16:13:15 +0100
From: setantae <setantae@submonkey.net>
Sender: setantae <setantae@submonkey.net>
Reply-To: setantae <setantae@submonkey.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: newfs -i x dumps core for small values of x
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         30959
>Category:       bin
>Synopsis:       newfs -i x dumps core for small values of x
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 01 08:20:02 PDT 2001
>Closed-Date:    Sat Nov 30 10:37:43 PST 2002
>Last-Modified:  Sat Nov 30 10:37:43 PST 2002
>Originator:     setantae
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD rhadamanth.private.submonkey.net 4.4-STABLE FreeBSD 4.4-STABLE #0: Mon Sep 24 15:48:56 BST 2001 setantae@rhadamanth.private.submonkey.net:/usr/obj/usr/src/sys/RHADAMANTH i386

	
>Description:
	Calling newfs with the -i option where the value passed is < 256
	causes newfs to dump core, or otherwise misbehave.

>How-To-Repeat:

< 128 :
	root@rhadamanth setantae# newfs -b 8192 -f 1024 -i64 /dev/ad2s2e
	Floating point exception (core dumped)
	root@rhadamanth setantae#

(this core dump is available if you want it)

< 256 :

	root@rhadamanth setantae# newfs -b 8192 -f 1024 -i128 /dev/ad2s2e
	/dev/ad2s2e:    65536 sectors in 16 cylinders of 1 tracks, 4096 sectors
	        32.0MB in 1 cyl groups (16 c/g, 32.00MB/g, 0 i/g)
	super-block backups (for fsck -b #) at:
	 32
	fsinit: inode value out of range (2).
	root@rhadamanth setantae#

>Fix:

	Create less inodes than you want by using values >= 256.

>Release-Note:
>Audit-Trail:

From: Ceri Davies <setantae@submonkey.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc: setantae@submonkey.net
Subject: Re: bin/30959: newfs -i x dumps core for small values of x
Date: Tue, 30 Oct 2001 17:18:09 +0000

 The above mentioned coredump is now available here:
 http://dogma.freebsd-uk.eu.org/~setantae/FreeBSD/pr/30959/
 
 Ceri
State-Changed-From-To: open->closed 
State-Changed-By: mckusick 
State-Changed-When: Sat Nov 30 10:32:51 PST 2002 
State-Changed-Why:  
From: Kirk McKusick <mckusick@FreeBSD.org> 
Date: Sat, 30 Nov 2002 10:28:26 -0800 (PST) 
To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org 
Subject: cvs commit: src/sbin/newfs mkfs.c newfs.c 

mckusick    2002/11/30 10:28:26 PST 

Modified files: 
sbin/newfs           mkfs.c newfs.c  
Log: 
Add some more checks to newfs so that it will not build filesystems 
that the kernel will refuse to mount. Specifically it now enforces 
the MAXBSIZE blocksize limit. This update also fixes a problem where 
newfs could segment fault if the selected fragment size was too large. 

PR:             bin/30959 
Submitted by:   Ceri Davies <setantae@submonkey.net> 
Sponsored by:   DARPA & NAI Labs. 

Revision  Changes    Path 
1.66      +24 -14    src/sbin/newfs/mkfs.c 
1.66      +5 -1      src/sbin/newfs/newfs.c 


http://www.freebsd.org/cgi/query-pr.cgi?pr=30959 
>Unformatted:
 >= 256 :
 
 	root@rhadamanth setantae# newfs -b 8192 -f 1024 -i256 /dev/ad2s2e
 	Warning: Bytes per inode restrict cylinders per group to 4.
 	/dev/ad2s2e:    65536 sectors in 16 cylinders of 1 tracks, 4096 sectors
 	        32.0MB in 4 cyl groups (4 c/g, 8.00MB/g, 21760 i/g)
 	super-block backups (for fsck -b #) at:
 	 32, 16416, 32800, 49184
 	root@rhadamanth setantae#
 
 
