* [Qemu-devel] [PATCH] Don't zero out buffer in sched_getaffinity
@ 2011-04-18 7:03 Mike McCormack
2011-04-18 9:17 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Mike McCormack @ 2011-04-18 7:03 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha, riku.voipio, vapier
The kernel doesn't fill the buffer provided to sched_getaffinity
with zero bytes, so neither should QEMU.
Depends on sched_getaffinity buffer overrun fix, but submitted
separately to make rollback easier.
---
linux-user/syscall.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 19209a2..e2a5fd9 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6382,20 +6382,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = get_errno(sys_sched_getaffinity(arg1, mask_size, mask));
if (!is_error(ret)) {
- if (arg2 > ret) {
- /* Zero out any extra space kernel didn't fill */
- unsigned long zero = arg2 - ret;
- p = alloca(zero);
- memset(p, 0, zero);
- if (copy_to_user(arg3 + ret, p, zero)) {
- goto efault;
- }
- arg2 = ret;
- }
- if (copy_to_user(arg3, mask, arg2)) {
+ if (copy_to_user(arg3, mask, ret)) {
goto efault;
}
- ret = arg2;
}
}
break;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Don't zero out buffer in sched_getaffinity
2011-04-18 7:03 [Qemu-devel] [PATCH] Don't zero out buffer in sched_getaffinity Mike McCormack
@ 2011-04-18 9:17 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-04-18 9:17 UTC (permalink / raw)
To: Mike McCormack; +Cc: riku.voipio, vapier, qemu-devel
On Mon, Apr 18, 2011 at 8:03 AM, Mike McCormack
<mj.mccormack@samsung.com> wrote:
> The kernel doesn't fill the buffer provided to sched_getaffinity
> with zero bytes, so neither should QEMU.
>
> Depends on sched_getaffinity buffer overrun fix, but submitted
> separately to make rollback easier.
>
> ---
> linux-user/syscall.c | 13 +------------
> 1 files changed, 1 insertions(+), 12 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-18 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 7:03 [Qemu-devel] [PATCH] Don't zero out buffer in sched_getaffinity Mike McCormack
2011-04-18 9:17 ` Stefan Hajnoczi
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).