Skip to content

x86/hyperv: Bug fix and enhancement

Sean Christopherson linux-hyperv lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v12 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Add Vitaly's review.
- Rebase to hyperv-next, commit 285f68afa8b2 ("x86/hyperv: Protect set_hv_tscchange_cb() against getting preempted"). [Vitaly]
- Tweak the changelog in patch 01 to omit the example about a bad VM config since the NULL check is needed even if that specific issue is resolved.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup failsarch/x86/hyperv/hv_init.c+3 -02 replies
2/2x86/hyperv: Move required MSRs check to initial platform probingarch/x86/hyperv/hv_init.c arch/x86/kernel/cpu/mshyperv.c+16 -130 replies

Reviews trailers per patch

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

PatchVitaly Kuznetsov
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] x86/hyperv: Bug fix and enhancement

Patch 01 is a fix for a NULL pointer deref that I ran into with a bad VMM configuration. That specific error path is remedied by patch 02, but Hyper-V can still end up in an inactive state if a memory allocation fails.

Patch 02 effectively makes the required MSRs mandatory for recognizing Hyper-V at all.

Some versions of QEMU prior to ~6.0 make it all too easy to advertise Hyper-V and a slew of features without advertising the Hyper-V HYPERCALL MSR, e.g. +hv-ipi,+hv-tlbflush,+hv-vpindex,+hv-reenlightenment advertises a bunch of things, but not the HYPERCALL MSR.

That results in the guest identifying Hyper-V and setting a variety of PV ops that then get ignored because hyperv_init() silently disables Hyper-V for all intents and purposes. The VMM (or its controller) is obviously off in the weeds, but ideally the guest kernel would acknowledge the bad setup in some way.

v2:
- Add Vitaly's review.
- Rebase to hyperv-next, commit 285f68afa8b2 ("x86/hyperv: Protect set_hv_tscchange_cb() against getting preempted"). [Vitaly]
- Tweak the changelog in patch 01 to omit the example about a bad VM config since the NULL check is needed even if that specific issue is resolved.

v1: https://lore.kernel.org/all/[email protected]/t/#u

Sean Christopherson (2):
x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup
fails
x86/hyperv: Move required MSRs check to initial platform probing

 arch/x86/hyperv/hv_init.c      | 12 ++++--------
 arch/x86/kernel/cpu/mshyperv.c | 20 +++++++++++++++-----
 2 files changed, 19 insertions(+), 13 deletions(-)
Signature · 1 line
2.34.0.rc0.344.g81b53c2807-goog