From owner-cvs-src@FreeBSD.ORG Mon Oct 1 11:10:07 2007 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 445CF16A47B; Mon, 1 Oct 2007 11:10:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id E211413C4B9; Mon, 1 Oct 2007 11:10:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 8FA3E41C757; Mon, 1 Oct 2007 13:10:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id wwrhcyEudYSB; Mon, 1 Oct 2007 13:10:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 35C1D41C75C; Mon, 1 Oct 2007 13:10:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id DAE82444885; Mon, 1 Oct 2007 11:06:58 +0000 (UTC) Date: Mon, 1 Oct 2007 11:06:58 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Bruce Evans In-Reply-To: <20071001201359.M2557@besplex.bde.org> Message-ID: <20071001110057.V85753@maildrop.int.zabbadoz.net> References: <200709241339.l8ODd6k6059694@repoman.freebsd.org> <47002674.8050707@tomjudge.com> <47002E2F.3030306@tomjudge.com> <20071001090547.H85753@maildrop.int.zabbadoz.net> <20071001201359.M2557@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/ufs/ffs ffs_alloc.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2007 11:10:07 -0000 On Mon, 1 Oct 2007, Bruce Evans wrote: > On Mon, 1 Oct 2007, Bjoern A. Zeeb wrote: > >> On Mon, 1 Oct 2007, Tom Judge wrote: >> >>> Tom Judge wrote: >>>> Bjoern A. Zeeb wrote: >>>>> bz 2007-09-24 13:39:06 UTC >>>>> >>>>> FreeBSD src repository >>>>> >>>>> Modified files: (Branch: RELENG_6) >>>>> sys/ufs/ffs ffs_alloc.c Log: >>>>> MFC rev. 1.147 >>>>> Fix a DIV0 in case a large value for fs_avgfilesize or fs_avgfpdir >>>>> is given (with newfs or tunefs) and dirsize overflows. >>>>> In case dirsize is <= 0 because of an overflow set maxcontigdirs >>>>> to 0 so it will be 1 later. This is what would happen for large >>>>> fs_avgfilesize. [1] >>>>> Submitted by: pjd [1] >>>>> Revision Changes Path >>>>> 1.132.2.7 +4 -1 src/sys/ufs/ffs/ffs_alloc.c >>>> >>>> >>>> Does this by any chance fis this PR: kern/111352? >>> >>> s/fis/fix/ >> >> yes it should. I closed the PR, See the comment there. > > s/fix/work around/ > > The bug is in newfs and tunefs permitting garbage parameters, so it cannot > be fixed in ffs_alloc.c. No matter what iput the kernel gets and from where, it MUST NOT (or at least SHOULD not;) panic unless explicitly request by KASSERT/panic/.. So this commit fixes a DIV0 bug in the kernel. Of course you are right, that the values should be checked by the tools that we have in the tree so that this problem would not occur. We could even check if the values given make sense at all, but that still is a different story to a kernel panic. -- Bjoern A. Zeeb bzeeb at Zabbadoz dot NeT Software is harder than hardware so better get it right the first time.