From: Michael Buesch <mb@bu3sch.de>
To: steiner@sgi.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sgi-gru: Fix kernel stack buffer overrun
Date: Tue, 21 Jul 2009 00:08:38 +0200 [thread overview]
Message-ID: <200907210008.38990.mb@bu3sch.de> (raw)
This patch fixes a kernel stack buffer overrun in the sgi-gru procfs
interface implementation.
The "count" parameter to options_write() is user controlled. So this bug
can be used to write '\0' bytes to almost arbitrary places on the kernel stack.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: stable@kernel.org
---
This procfs file has 0644 permissions, so the bug is probably not exploitable
for local privilege escalation.
---
drivers/misc/sgi-gru/gruprocfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-2.6.orig/drivers/misc/sgi-gru/gruprocfs.c
+++ linux-2.6/drivers/misc/sgi-gru/gruprocfs.c
@@ -157,23 +157,23 @@ static int options_show(struct seq_file
seq_printf(s, "0x%lx\n", gru_options);
return 0;
}
static ssize_t options_write(struct file *file, const char __user *userbuf,
size_t count, loff_t *data)
{
unsigned long val;
char buf[80];
+ memset(buf, 0, sizeof(buf));
if (strncpy_from_user(buf, userbuf, sizeof(buf) - 1) < 0)
return -EFAULT;
- buf[count - 1] = '\0';
if (!strict_strtoul(buf, 10, &val))
gru_options = val;
return count;
}
static int cch_seq_show(struct seq_file *file, void *data)
{
long gid = *(long *)data;
int i;
--
Greetings, Michael.
next reply other threads:[~2009-07-20 22:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 22:08 Michael Buesch [this message]
2009-07-20 23:26 ` [PATCH] sgi-gru: Fix kernel stack buffer overrun Jack Steiner
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=200907210008.38990.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=steiner@sgi.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