Date: Fri, 22 May 2009 00:48:25 +1000 (EST) From: Emil Mikulic <emikulic@gmail.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: amd64/134786: [patch] vfs.bufspace sysctl wideness on amd64 Message-ID: <20090521144825.5E65F5C40@ppp154-240.static.internode.on.net> Resent-Message-ID: <200905211450.n4LEo4P6065698@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090521144825.5E65F5C40>