From owner-freebsd-amd64@FreeBSD.ORG Thu May 21 14:50:04 2009 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA820106566B for ; Thu, 21 May 2009 14:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7C5E38FC1E for ; Thu, 21 May 2009 14:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n4LEo4o0065699 for ; Thu, 21 May 2009 14:50:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n4LEo4P6065698; Thu, 21 May 2009 14:50:04 GMT (envelope-from gnats) Resent-Date: Thu, 21 May 2009 14:50:04 GMT Resent-Message-Id: <200905211450.n4LEo4P6065698@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-amd64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Emil Mikulic Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1FB2106566B for ; Thu, 21 May 2009 14:48:28 +0000 (UTC) (envelope-from emil@dmr.ath.cx) Received: from ipmail04.adl2.internode.on.net (ipmail04.adl2.internode.on.net [203.16.214.57]) by mx1.freebsd.org (Postfix) with ESMTP id 784FB8FC12 for ; Thu, 21 May 2009 14:48:28 +0000 (UTC) (envelope-from emil@dmr.ath.cx) Received: from ppp154-240.static.internode.on.net ([150.101.154.240]) by ipmail04.adl2.internode.on.net with ESMTP; 22 May 2009 00:18:26 +0930 Received: by ppp154-240.static.internode.on.net (Poo-fix, from userid 1001) id 5E65F5C40; Fri, 22 May 2009 00:48:25 +1000 (EST) Message-Id: <20090521144825.5E65F5C40@ppp154-240.static.internode.on.net> Date: Fri, 22 May 2009 00:48:25 +1000 (EST) From: Emil Mikulic To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 X-Mailman-Approved-At: Thu, 21 May 2009 15:10:24 +0000 Cc: Subject: 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 14:50:05 -0000 >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)); >Release-Note: >Audit-Trail: >Unformatted: