lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240826022255.361406-1-binbin.wu@linux.intel.com>
Date: Mon, 26 Aug 2024 10:22:53 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: pbonzini@...hat.com,
	seanjc@...gle.com,
	isaku.yamahata@...el.com,
	rick.p.edgecombe@...el.com,
	kai.huang@...el.com,
	yuan.yao@...ux.intel.com,
	xiaoyao.li@...el.com,
	binbin.wu@...ux.intel.com
Subject: [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/184d90a8-14a0-494a-9112-365417245911@linux.intel.com/
- 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
-- 
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ