All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/HVM: memset CPU context save area
@ 2016-01-19 17:42 Roger Pau Monne
  2016-01-19 17:44 ` Roger Pau Monné
  2016-01-19 18:21 ` [PATCH] x86/HVM: memset CPU context save area Andrew Cooper
  0 siblings, 2 replies; 6+ messages in thread
From: Roger Pau Monne @ 2016-01-19 17:42 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Roger Pau Monne

In order to prevent leaking data in the padding field. Also remove the
memset done to the fpu_regs in case of no FPU context present, since it's
already taken care by the memset of the whole CPU context structure. The
same applies to setting ctxt.flags to 0 in case there's no FPU context.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8f98956..674feea 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1732,6 +1732,8 @@ static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
         if ( v->pause_flags & VPF_down )
             continue;
 
+        memset(&ctxt, 0, sizeof(ctxt));
+
         /* Architecture-specific vmcs/vmcb bits */
         hvm_funcs.save_cpu_ctxt(v, &ctxt);
 
@@ -1798,11 +1800,6 @@ static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
             memcpy(ctxt.fpu_regs, v->arch.fpu_ctxt, sizeof(ctxt.fpu_regs));
             ctxt.flags = XEN_X86_FPU_INITIALISED;
         }
-        else
-        {
-             memset(ctxt.fpu_regs, 0, sizeof(ctxt.fpu_regs));
-             ctxt.flags = 0;
-        }
 
         ctxt.rax = v->arch.user_regs.eax;
         ctxt.rbx = v->arch.user_regs.ebx;
-- 
1.9.5 (Apple Git-50.3)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-19 18:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-19 17:42 [PATCH] x86/HVM: memset CPU context save area Roger Pau Monne
2016-01-19 17:44 ` Roger Pau Monné
2016-01-19 17:43   ` [xen-unstable-smoke test] 78539: regressions - FAIL osstest service owner
2016-01-19 17:48     ` Roger Pau Monné
2016-01-19 18:34       ` [xen-unstable-smoke test] 78539: regressions - FAIL [and 3 more messages] Ian Jackson
2016-01-19 18:21 ` [PATCH] x86/HVM: memset CPU context save area Andrew Cooper

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.