From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: torvalds@osdl.org
Cc: yang.y.yi@gmail.com, linux-kernel@vger.kernel.org,
gregkh@suse.de, akpm@osdl.org, yoshfuji@linux-ipv6.org
Subject: Re: [PATCH] Fix user data corrupted by old value return of sysctl
Date: Sat, 31 Dec 2005 20:47:17 +0900 (JST) [thread overview]
Message-ID: <20051231.204717.124347182.yoshfuji@linux-ipv6.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0512300916220.3249@g5.osdl.org>
Hello.
In article <Pine.LNX.4.64.0512300916220.3249@g5.osdl.org> (at Fri, 30 Dec 2005 09:25:35 -0800 (PST)), Linus Torvalds <torvalds@osdl.org> says:
> On Fri, 30 Dec 2005, Yi Yang wrote:
> >
> > If the user reads a sysctl entry which is of string type
> > by sysctl syscall, this call probably corrupts the user data
> > right after the old value buffer, the issue lies in sysctl_string
> > seting 0 to oldval[len], len is the available buffer size
> > specified by the user, obviously, this will write to the first
> > byte of the user memory place immediate after the old value buffer,
> > the correct way is that sysctl_string doesn't set 0, the user
> > should do it by self in the program.
:
> We _should_ zero-pad the data, at least if the result fits in the buffer.
:
> But even that is questionable: one alternative is to always zero-pad (like
> we used to), but make sure that the buffer size is sufficient for it (ie
> instead of adding one to the length of the string, we'd subtract one from
> the buffer length and make sure that the '\0' fits..
How about returning -ENOMEM, as BSDs (FreeBSD and NetBSD
at least) do. No?
--yoshfuji
next prev parent reply other threads:[~2005-12-31 11:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-30 8:40 Yi Yang
2005-12-30 17:25 ` Linus Torvalds
2005-12-31 1:08 ` Yi Yang
2005-12-31 9:25 ` Coywolf Qi Hunt
2005-12-31 11:47 ` YOSHIFUJI Hideaki / 吉藤英明 [this message]
2005-12-30 22:31 ` David Wagner
2005-12-31 9:13 ` Coywolf Qi Hunt
2005-12-31 9:26 ` Yi Yang
2005-12-31 9:44 ` Coywolf Qi Hunt
2006-01-04 1:41 ` Yi Yang
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=20051231.204717.124347182.yoshfuji@linux-ipv6.org \
--to=yoshfuji@linux-ipv6.org \
--cc=akpm@osdl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=yang.y.yi@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
all inboxes | Powered by JetHome®