From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>,
Paul Mackerras <paulus@samba.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] perf_counter: fix buffer overflow in perf_copy_attr()
Date: Tue, 15 Sep 2009 14:44:36 +0800 [thread overview]
Message-ID: <4AAF37D4.5010706@cn.fujitsu.com> (raw)
If we pass a big size data over perf_counter_open syscall, the kernel
will copy this data to a small buffer, It will cause kernel crash.
This bug make kernel unsafe and no-root user can trigger it.
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
kernel/perf_counter.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 667ab25..75c46c0 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -4216,6 +4216,7 @@ static int perf_copy_attr(struct perf_counter_attr __user *uattr,
if (val)
goto err_size;
}
+ size = sizeof(*attr);
}
ret = copy_from_user(attr, uattr, size);
--
1.6.1.2
next reply other threads:[~2009-09-15 6:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-15 6:44 Xiao Guangrong [this message]
2009-09-15 6:55 ` [PATCH] perf_counter: fix buffer overflow in perf_copy_attr() Paul Mackerras
2009-09-15 7:40 ` Peter Zijlstra
2009-09-15 9:21 ` [tip:perfcounters/urgent] perf_counter: Fix " tip-bot for Xiao Guangrong
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=4AAF37D4.5010706@cn.fujitsu.com \
--to=xiaoguangrong@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.