From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Tom Tucker <tom@opengridcomputing.com>,
Neil Brown <neilb@suse.de>, Chuck Lever <chuck.lever@oracle.com>,
Greg Banks <gnb@sgi.com>,
"J. Bruce Fields" <bfields@citi.umich.edu>,
linux-kernel@vger.kernel.org
Subject: Re: buffer overflow in /proc/sys/sunrpc/transports
Date: Sat, 30 Aug 2008 23:44:20 +0400 [thread overview]
Message-ID: <20080830194420.GF7611@lenovo> (raw)
In-Reply-To: <19f34abd0808301234k3fae5572xdd8835827201f15@mail.gmail.com>
[Vegard Nossum - Sat, Aug 30, 2008 at 09:34:21PM +0200]
| On Sat, Aug 30, 2008 at 9:21 PM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
| > | Hm. I think this is wrong. Shouldn't we copy as many bytes as the user
| > | indicated?
| >
| > Well, hard to say what user-space programmer is expecting from us.
| > I mean - maybe he (reader) wants only part of results not the whole
| > contents BUT by this way he never know what the whole conetnts would be
| > until trying to read more (ie to check if there no more data from
| > kernel side). What is preferred behaviour - i don't know :)
|
| For any other file, read(1) + read(1) should be exactly equivalent to
| a read(2). What's the difference here?
Convinced completely :) Moreover proc_dodebug() does exactly
the same as you talking about.
|
| (Btw, thanks for the quick reply :-))
with my pleasure :)
|
|
| Vegard
|
| --
| "The animistic metaphor of the bug that maliciously sneaked in while
| the programmer was not looking is intellectually dishonest as it
| disguises that the error is the programmer's own creation."
| -- E. W. Dijkstra, EWD1036
|
- Cyrill -
---
Index: linux-2.6.git/net/sunrpc/sysctl.c
===================================================================
--- linux-2.6.git.orig/net/sunrpc/sysctl.c 2008-07-20 11:40:14.000000000 +0400
+++ linux-2.6.git/net/sunrpc/sysctl.c 2008-08-30 23:43:14.000000000 +0400
@@ -71,7 +71,8 @@ static int proc_do_xprt(ctl_table *table
len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
if (!access_ok(VERIFY_WRITE, buffer, len))
return -EFAULT;
-
+ if (*lenp < len)
+ len = *lenp;
if (__copy_to_user(buffer, tmpbuf, len))
return -EFAULT;
}
next prev parent reply other threads:[~2008-08-30 19:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-30 18:44 buffer overflow in /proc/sys/sunrpc/transports Vegard Nossum
2008-08-30 19:06 ` Cyrill Gorcunov
2008-08-30 19:15 ` Vegard Nossum
2008-08-30 19:21 ` Cyrill Gorcunov
2008-08-30 19:23 ` Cyrill Gorcunov
2008-08-30 19:34 ` Vegard Nossum
2008-08-30 19:44 ` Cyrill Gorcunov [this message]
2008-08-30 19:42 ` Vegard Nossum
2008-08-30 19:45 ` Cyrill Gorcunov
2008-08-30 19:56 ` Cyrill Gorcunov
2008-08-30 19:59 ` Vegard Nossum
2008-08-30 20:04 ` Cyrill Gorcunov
2008-08-30 20:13 ` Vegard Nossum
2008-08-30 20:15 ` Cyrill Gorcunov
2008-08-30 20:29 ` Cyrill Gorcunov
2008-08-30 22:55 ` David Wagner
2008-08-31 8:37 ` Cyrill Gorcunov
2008-08-31 10:30 ` Cyrill Gorcunov
2008-08-31 10:37 ` Cyrill Gorcunov
2008-08-30 20:20 ` David Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080830194420.GF7611@lenovo \
--to=gorcunov@gmail.com \
--cc=bfields@citi.umich.edu \
--cc=chuck.lever@oracle.com \
--cc=gnb@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tom@opengridcomputing.com \
--cc=vegard.nossum@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox