From owner-freebsd-amd64@FreeBSD.ORG Thu May 21 16:21:07 2009 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E1491065673; Thu, 21 May 2009 16:21:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D4E8C8FC13; Thu, 21 May 2009 16:21:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 711EA46B2C; Thu, 21 May 2009 12:21:06 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 486A18A025; Thu, 21 May 2009 12:21:05 -0400 (EDT) From: John Baldwin To: freebsd-amd64@freebsd.org Date: Thu, 21 May 2009 12:16:26 -0400 User-Agent: KMail/1.9.7 References: <20090521144825.5E65F5C40@ppp154-240.static.internode.on.net> In-Reply-To: <20090521144825.5E65F5C40@ppp154-240.static.internode.on.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905211216.26962.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 21 May 2009 12:21:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: FreeBSD-gnats-submit@freebsd.org, Emil Mikulic Subject: Re: amd64/134786: [patch] vfs.bufspace sysctl wideness on amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2009 16:21:07 -0000 On Thursday 21 May 2009 10:48:25 am Emil Mikulic wrote: > > >Number: 134786 > >Category: amd64 > >Synopsis: [patch] vfs.bufspace sysctl wideness on amd64 > >Confidential: no > >Severity: non-critical > >Priority: low > >Responsible: freebsd-amd64 > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Thu May 21 14:50:04 UTC 2009 > >Closed-Date: > >Last-Modified: > >Originator: Emil Mikulic > >Release: FreeBSD 8-CURRENT > >Organization: > >Environment: > >Description: > > On amd64, providing a 64-bit buffer to get the vfs.bufspace sysctl will > return a 64-bit (long) quantity, but providing a *larger* buffer will > only yield a 32-bit (int) quantity. > > >How-To-Repeat: > > len = 8; > sysctlbyname("vfs.bufspace", &buf, &len, NULL, 0); > /* len is still 8 */ > > len = 10; > sysctlbyname("vfs.bufspace", &buf, &len, NULL, 0); > /* len is 4! */ > > >Fix: > > --- sys/kern/vfs_bio.c 2009-04-17 10:01:39.000000000 +0000 > +++ sys/kern/vfs_bio.c.2 2009-05-09 09:27:16.000000000 +0000 > @@ -288,15 +288,15 @@ > defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) > static int > sysctl_bufspace(SYSCTL_HANDLER_ARGS) > { > long lvalue; > int ivalue; > > - if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) > + if (sizeof(int) == sizeof(long) || req->oldlen >= sizeof(long)) > return (sysctl_handle_long(oidp, arg1, arg2, req)); > lvalue = *(long *)arg1; > if (lvalue > INT_MAX) > /* On overflow, still write out a long to trigger ENOMEM. */ > return (sysctl_handle_long(oidp, &lvalue, 0, req)); > ivalue = lvalue; > return (sysctl_handle_int(oidp, &ivalue, 0, req)); Hummm. I guess that is correct, though that is a bit odd. -- John Baldwin