]> git.baikalelectronics.ru Git - kernel.git/commit
x86/sev-es: Use __copy_from_user_inatomic()
authorJoerg Roedel <jroedel@suse.de>
Wed, 3 Mar 2021 14:17:16 +0000 (15:17 +0100)
committerBorislav Petkov <bp@suse.de>
Tue, 9 Mar 2021 11:37:54 +0000 (12:37 +0100)
commitd5e96d4332887c40ecd96f7d05917cf5d9cf6371
treec58ca5fed0bca563661eac21fa1d72c0c2f72c30
parente4ad34399bb13418842f1bedcfb0baa0ab5e8d07
x86/sev-es: Use __copy_from_user_inatomic()

The #VC handler must run in atomic context and cannot sleep. This is a
problem when it tries to fetch instruction bytes from user-space via
copy_from_user().

Introduce a insn_fetch_from_user_inatomic() helper which uses
__copy_from_user_inatomic() to safely copy the instruction bytes to
kernel memory in the #VC handler.

Fixes: ca7508e3fe6f7 ("x86/sev-es: Handle instruction fetches from user-space")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: stable@vger.kernel.org # v5.10+
Link: https://lkml.kernel.org/r/20210303141716.29223-6-joro@8bytes.org
arch/x86/include/asm/insn-eval.h
arch/x86/kernel/sev-es.c
arch/x86/lib/insn-eval.c