Commit dda18d80 authored by Michael Sterritt's avatar Michael Sterritt Committed by Zheng Zengkai
Browse files

x86/sev: Fix SEV-ES INS/OUTS instructions for word, dword, and qword

stable inclusion
from stable-v5.10.84
commit c8e341191849a6b3a962b234926bec30b9d159fe
bugzilla: 186030 https://gitee.com/openeuler/kernel/issues/I4QV2F

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c8e341191849a6b3a962b234926bec30b9d159fe



--------------------------------

[ Upstream commit 1d5379d0 ]

Properly type the operands being passed to __put_user()/__get_user().
Otherwise, these routines truncate data for dependent instructions
(e.g., INSW) and only read/write one byte.

This has been tested by sending a string with REP OUTSW to a port and
then reading it back in with REP INSW on the same port.

Previous behavior was to only send and receive the first char of the
size. For example, word operations for "abcd" would only read/write
"ac". With change, the full string is now written and read back.

Fixes: f980f9c3 (x86/sev-es: Compile early handler code into kernel image)
Signed-off-by: default avatarMichael Sterritt <sterritt@google.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarMarc Orr <marcorr@google.com>
Reviewed-by: default avatarPeter Gonda <pgonda@google.com>
Reviewed-by: default avatarJoerg Roedel <jroedel@suse.de>
Link: https://lkml.kernel.org/r/20211119232757.176201-1-sterritt@google.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 0490014b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment