Re: [PATCH v2] KVM: x86: avoid large stack allocations in em_fxrstor

From: kbuild test robot
Date: Mon May 29 2017 - 16:15:04 EST


Hi Nick,

[auto build test WARNING on kvm/linux-next]
[also build test WARNING on v4.12-rc3 next-20170529]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Nick-Desaulniers/KVM-x86-avoid-large-stack-allocations-in-em_fxrstor/20170530-040058
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

arch/x86/kvm/emulate.c: In function 'em_fxrstor':
>> arch/x86/kvm/emulate.c:4015:5: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized]
rc = segmented_read_std(ctxt, ctxt->memop.addr.mem, &fx_state, size);
~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/size +4015 arch/x86/kvm/emulate.c

3999
4000 if (ctxt->mode < X86EMUL_MODE_PROT64) {
4001 rc = asm_safe("fxsave %[fx]", , [fx] "+m"(fx_state));
4002 if (rc != X86EMUL_CONTINUE)
4003 return rc;
4004 /*
4005 * Hardware doesn't save and restore XMM 0-7 without
4006 * CR4.OSFXSR, but does save and restore MXCSR.
4007 */
4008 if (ctxt->ops->get_cr(ctxt, 4) & X86_CR4_OSFXSR)
4009 size = offsetof(struct fxregs_state, xmm_space[8]);
4010 else
4011 size = offsetof(struct fxregs_state, xmm_space[0]);
4012 } else if (ctxt->mode == X86EMUL_MODE_PROT64)
4013 size = offsetof(struct fxregs_state, xmm_space[16]);
4014
> 4015 rc = segmented_read_std(ctxt, ctxt->memop.addr.mem, &fx_state, size);
4016 if (rc != X86EMUL_CONTINUE)
4017 return rc;
4018
4019 if (fx_state.mxcsr >> 16)
4020 return emulate_gp(ctxt, 0);
4021
4022 if (rc == X86EMUL_CONTINUE)
4023 rc = asm_safe("fxrstor %[fx]", : [fx] "m"(fx_state));

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip