target/i386: do not access beyond the low 128 bits of SSE registers
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 11 Apr 2022 16:15:07 +0000 (18:15 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Apr 2022 16:59:52 +0000 (18:59 +0200)
commitd22697dde0944e5137a8315f4e1a88979fb0ada7
tree8df5178f01614077570979d7cbbe00bf0e4304b4
parenta43de7980265323db4ee752b218dc784e3c69f9f
target/i386: do not access beyond the low 128 bits of SSE registers

The i386 target consolidates all vector registers so that instead of
XMMReg, YMMReg and ZMMReg structs there is a single ZMMReg that can
fit all of SSE, AVX and AVX512.

When TCG copies data from and to the SSE registers, it uses the
full 64-byte width.  This is not a correctness issue because TCG
never lets guest code see beyond the first 128 bits of the ZMM
registers, however it causes uninitialized stack memory to
make it to the CPU's migration stream.

Fix it by only copying the low 16 bytes of the ZMMReg union into
the destination register.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/ops_sse.h