* [PATCH v2] powerpc: kvm: powerpc: fix information leak to userland
@ 2010-10-30 18:55 Vasiliy Kulikov
[not found] ` <1288464922-8812-1-git-send-email-segooon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Vasiliy Kulikov @ 2010-10-30 18:55 UTC (permalink / raw)
To: kernel-janitors
Cc: Alexander Graf, Avi Kivity, Marcelo Tosatti,
Benjamin Herrenschmidt, Paul Mackerras, kvm-ppc, kvm,
linuxppc-dev, linux-kernel
Structure kvm_ppc_pvinfo is copied to userland with "flags" and "pad"
fields unitialized. It leads to leaking of contents of kernel stack
memory. We have to initialize them to zero.
In patch v1 Jan Kiszka suggested to fill reserved fields with zeros
instead of memset'ting the whole struct. It makes sense as these
fields are explicitly marked as padding. No more fields need zeroing.
Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
arch/powerpc/kvm/powerpc.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2f87a16..5962336 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -604,6 +604,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
pvinfo->hcall[1] = inst_ori | (KVM_SC_MAGIC_R0 & inst_imm_mask);
pvinfo->hcall[2] = inst_sc;
pvinfo->hcall[3] = inst_nop;
+ pvinfo->flags = 0;
+ memset(&pvinfo->pad, 0, sizeof(pvinfo->pad));
return 0;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] powerpc: kvm: powerpc: fix information leak to userland
[not found] ` <1288464922-8812-1-git-send-email-segooon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2010-10-30 19:16 ` Alexander Graf
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2010-10-30 19:16 UTC (permalink / raw)
To: Vasiliy Kulikov
Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Avi Kivity,
Marcelo Tosatti, Benjamin Herrenschmidt, Paul Mackerras,
kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm-u79uwXL29TY76Z2rM5mHXA,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 30.10.2010, at 11:55, Vasiliy Kulikov wrote:
> Structure kvm_ppc_pvinfo is copied to userland with "flags" and "pad"
> fields unitialized. It leads to leaking of contents of kernel stack
> memory. We have to initialize them to zero.
>
> In patch v1 Jan Kiszka suggested to fill reserved fields with zeros
> instead of memset'ting the whole struct. It makes sense as these
> fields are explicitly marked as padding. No more fields need zeroing.
>
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> ---
> arch/powerpc/kvm/powerpc.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 2f87a16..5962336 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -604,6 +604,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
> pvinfo->hcall[1] = inst_ori | (KVM_SC_MAGIC_R0 & inst_imm_mask);
> pvinfo->hcall[2] = inst_sc;
> pvinfo->hcall[3] = inst_nop;
> + pvinfo->flags = 0;
> + memset(&pvinfo->pad, 0, sizeof(pvinfo->pad));
This should only be memset(pvinfo->pad), no? It's an array after all which automatically translates to a pointer when referenced.
Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-30 19:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-30 18:55 [PATCH v2] powerpc: kvm: powerpc: fix information leak to userland Vasiliy Kulikov
[not found] ` <1288464922-8812-1-git-send-email-segooon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-10-30 19:16 ` Alexander Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox