diff options
author | Joerg Roedel <jroedel@suse.de> | 2021-03-03 17:17:16 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-03-09 14:37:54 +0300 |
commit | bffe30dd9f1f3b2608a87ac909a224d6be472485 (patch) | |
tree | c58ca5fed0bca563661eac21fa1d72c0c2f72c30 /arch/x86/include/asm/insn-eval.h | |
parent | 62441a1fb53263bda349b6e5997c3cc5c120d89e (diff) | |
download | linux-bffe30dd9f1f3b2608a87ac909a224d6be472485.tar.xz |
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: 5e3427a7bc432 ("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
Diffstat (limited to 'arch/x86/include/asm/insn-eval.h')
-rw-r--r-- | arch/x86/include/asm/insn-eval.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/include/asm/insn-eval.h b/arch/x86/include/asm/insn-eval.h index a0f839aa144d..98b4dae5e8bc 100644 --- a/arch/x86/include/asm/insn-eval.h +++ b/arch/x86/include/asm/insn-eval.h @@ -23,6 +23,8 @@ unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx); int insn_get_code_seg_params(struct pt_regs *regs); int insn_fetch_from_user(struct pt_regs *regs, unsigned char buf[MAX_INSN_SIZE]); +int insn_fetch_from_user_inatomic(struct pt_regs *regs, + unsigned char buf[MAX_INSN_SIZE]); bool insn_decode(struct insn *insn, struct pt_regs *regs, unsigned char buf[MAX_INSN_SIZE], int buf_size); |