From owner-freebsd-hackers@FreeBSD.ORG Sat Jan 16 07:27:34 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C068B106566C for ; Sat, 16 Jan 2010 07:27:34 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id 7FEB28FC0C for ; Sat, 16 Jan 2010 07:27:34 +0000 (UTC) Received: from a91-153-117-195.elisa-laajakaista.fi (a91-153-117-195.elisa-laajakaista.fi [91.153.117.195]) by gw01.mail.saunalahti.fi (Postfix) with ESMTP id C80C21513E5; Sat, 16 Jan 2010 09:11:15 +0200 (EET) Date: Sat, 16 Jan 2010 09:11:15 +0200 From: Jaakko Heinonen To: Jilles Tjoelker Message-ID: <20100116071114.GA7988@a91-153-117-195.elisa-laajakaista.fi> References: <1bd550a01001010945i1a043ff9t70eb814cafe4b30a@mail.gmail.com> <20100101193814.GA60021@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20100101193814.GA60021@stack.nl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: FreeBSD Hackers , des@FreeBSD.org, Fernando =?utf-8?Q?Apestegu=C3=ADa?= Subject: Re: linprocfs Input/output error X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jan 2010 07:27:34 -0000 On 2010-01-01, Jilles Tjoelker wrote: > On Fri, Jan 01, 2010 at 06:45:33PM +0100, Fernando ApesteguĂ­a wrote: > > > cat: /compat/linux/proc/cpuinfo: Input/output error > > pfs_read() fails any read over MAXPHYS + 1 with EIO. This limit probably > has to do with the allocation of a buffer of that size using sbuf_new(9) > (and so, malloc(9)). > > Some sort of limit seems appropriate, but MAXPHYS seems unrelated, and > if the request is too long it should perhaps just truncate it. With a quick test this patch seems to work: %%% Index: sys/fs/pseudofs/pseudofs_vnops.c =================================================================== --- sys/fs/pseudofs/pseudofs_vnops.c (revision 202405) +++ sys/fs/pseudofs/pseudofs_vnops.c (working copy) @@ -637,10 +637,8 @@ pfs_read(struct vop_read_args *va) error = EINVAL; goto ret; } - if (buflen > MAXPHYS + 1) { - error = EIO; - goto ret; - } + if (buflen > MAXPHYS + 1) + buflen = MAXPHYS + 1; sb = sbuf_new(sb, NULL, buflen, 0); if (sb == NULL) { %%% Maybe des@ can comment if this looks sane? -- Jaakko