Message ID | 20210512075445.18935-5-joro@8bytes.org |
---|---|
State | New |
Headers | show |
Series | [1/6] x86/sev-es: Don't return NULL from sev_es_get_ghcb() | expand |
On Wed, May 12, 2021 at 05:38:29PM +0000, Sean Christopherson wrote: > Alternatively, and probably even better, fold this revert into the switch to > the unchecked version (sounds like those will use kernel-specific flavors?). I folded this revert into the previous commit. But I kept the __get_user()/__put_user() calls and just added a comment explaining why they are used and why it is safe to use them. After all, even the get_kernel*() functions call __get_user_size() under the hood. Regards, Joerg
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c index 110b39345b40..f4f319004713 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -333,12 +333,6 @@ static enum es_result vc_write_mem(struct es_em_ctxt *ctxt, u16 d2; u8 d1; - /* If instruction ran in kernel mode and the I/O buffer is in kernel space */ - if (!user_mode(ctxt->regs) && !access_ok(target, size)) { - memcpy(dst, buf, size); - return ES_OK; - } - switch (size) { case 1: memcpy(&d1, buf, 1); @@ -388,12 +382,6 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt, u16 d2; u8 d1; - /* If instruction ran in kernel mode and the I/O buffer is in kernel space */ - if (!user_mode(ctxt->regs) && !access_ok(s, size)) { - memcpy(buf, src, size); - return ES_OK; - } - switch (size) { case 1: if (__get_user(d1, s))