Skip to content

KVM: x86: Check hypercall's exit to userspace generically

Binbin Wu kvm lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 25 repliesIn review
  2. v22 patches 16 repliesSuperseded
  3. v12 patches 1 replySuperseded

Changes in v3 from the cover letter

- Rename is_kvm_hc_exit_enabled() to user_exit_on_hypercall(). (Sean)
- Remove the WARN_ON_ONCE(). (Isaku, Sean)
- Use BIT(hc_nr) instead of (1 << nr) (Yuan)
- Added a comment to explain why check the !ret first. (Kai)
- Add Kai and Isaku's Reviewed-by.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KVM: x86: Check hypercall's exit to userspace genericallyarch/x86/kvm/x86.c arch/x86/kvm/x86.h+7 -223 replies
2/2KVM: x86: Use user_exit_on_hypercall() instead of opencodearch/x86/kvm/svm/sev.c arch/x86/kvm/x86.c+3 -31 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchKai HuangIsaku YamahataXiaoyao Li
1/2R-b R-b R-b
2/2R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/2] KVM: x86: Check hypercall's exit to userspace generically

Currently in kvm_emulate_hypercall, KVM_HC_MAP_GPA_RANGE is checked specifically to decide whether a KVM hypercall needs to exit to userspace or not. Do the check based on the hypercall_exit_enabled field of struct kvm_arch.

Also use the API user_exit_on_hypercall() to replace the opencode.

---
v3:
- Rename is_kvm_hc_exit_enabled() to user_exit_on_hypercall(). (Sean)
- Remove the WARN_ON_ONCE(). (Isaku, Sean)
- Use BIT(hc_nr) instead of (1 << nr) (Yuan)
- Added a comment to explain why check the !ret first. (Kai)
- Add Kai and Isaku's Reviewed-by.

v2:
- Check the return value of __kvm_emulate_hypercall() before checking hypercall_exit_enabled to avoid an invalid KVM hypercall nr.
https://lore.kernel.org/kvm/[email protected]/
- Add a warning if a hypercall nr out of the range of hypercall_exit_enabled can express.

Binbin Wu (2):
KVM: x86: Check hypercall's exit to userspace generically
KVM: x86: Use user_exit_on_hypercall() instead of opencode

 arch/x86/kvm/svm/sev.c | 4 ++--
 arch/x86/kvm/x86.c     | 7 ++++---
 arch/x86/kvm/x86.h     | 4 ++++
 3 files changed, 10 insertions(+), 5 deletions(-)

base-commit: a1206bc992c3cd3f758a9b46117dfc7e59e8c10f

Signature · 1 line
2.46.0