From: Stefan Hajnoczi <stefanha@gmail.com>
To: Mike McCormack <mj.mccormack@samsung.com>
Cc: Riku Voipio <riku.voipio@nokia.com>,
Mike Frysinger <vapier@gentoo.org>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Fix buffer overrun in sched_getaffinity
Date: Sat, 16 Apr 2011 10:16:23 +0100 [thread overview]
Message-ID: <20110416091623.GB22205@stefanha-thinkpad.localdomain> (raw)
In-Reply-To: <4DA3CB84.5080503@samsung.com>
On Tue, Apr 12, 2011 at 12:48:20PM +0900, Mike McCormack wrote:
> Zeroing of the cpu array should start from &cpus[kernel_ret]
> not &cpus[num_zeros_to_fill].
>
> This fixes a crash in EFL's edje_cc running under qemu-arm.
>
> Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
> ---
> linux-user/syscall.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index bb0999d..1cda10a 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6389,7 +6389,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> unsigned long zero = arg2 - ret;
> p = alloca(zero);
> memset(p, 0, zero);
> - if (copy_to_user(arg3 + zero, p, zero)) {
> + if (copy_to_user(arg3 + ret, p, zero)) {
> goto efault;
> }
> arg2 = ret;
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Note that mainline Linux does not zero unwritten bytes. I would drop
the entire arg2 > ret case and instead copy only ret bytes to user.
Stefan
next prev parent reply other threads:[~2011-04-16 9:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-12 3:48 [Qemu-devel] [PATCH] Fix buffer overrun in sched_getaffinity Mike McCormack
2011-04-16 9:16 ` Stefan Hajnoczi [this message]
2011-04-16 18:18 ` Mike Frysinger
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=20110416091623.GB22205@stefanha-thinkpad.localdomain \
--to=stefanha@gmail.com \
--cc=mj.mccormack@samsung.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@nokia.com \
--cc=vapier@gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).