Date: Sat, 16 Jan 2010 09:11:15 +0200 From: Jaakko Heinonen <jh@FreeBSD.org> To: Jilles Tjoelker <jilles@stack.nl> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org>, des@FreeBSD.org, Fernando =?utf-8?Q?Apestegu=C3=ADa?= <fernando.apesteguia@gmail.com> Subject: Re: linprocfs Input/output error Message-ID: <20100116071114.GA7988@a91-153-117-195.elisa-laajakaista.fi> In-Reply-To: <20100101193814.GA60021@stack.nl> References: <1bd550a01001010945i1a043ff9t70eb814cafe4b30a@mail.gmail.com> <20100101193814.GA60021@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100116071114.GA7988>
