Re: [PATCH v2 1/1] x86/hyperv: Avoid using per-cpu output page in hv_apicid_to_vp_index()

From: Wei Liu

Date: Sun Sep 13 2026 - 18:36:14 EST


On Wed, Sep 02, 2026 at 02:30:02PM +0800, Tianyu Lan wrote:
> On Wed, Sep 2, 2026 at 11:02 AM Michael Kelley <mhkelley58@xxxxxxxxx> wrote:
> >
> > hv_apicid_to_vp_index() currently uses the per-cpu hypercall input
> > and output pages. This function is called when running in VTL2 and
> > when running in an SEV-SNP CoCo VM with no paravisor. In the former
> > case, the output page is allocated, but in the latter case it is
> > not, so the hypervisor stores the output VP index in memory that has
> > not been allocated by the guest.
> >
> > Fix this by using the input page for both input and output. The
> > hypercall has very small input and output, so sharing the same
> > page for both is straightforward. An alternative fix is to
> > allocate the per-cpu output page when running in an SEV-SNP CoCo
> > guest, but this uses significantly more memory, particularly
> > with larger vCPUs counts.
> >
> > Fixes: 86c48271e0d6 ("x86/hyperv: Fix APIC ID and VP index confusion in hv_snp_boot_ap()")
> > Signed-off-by: Michael Kelley <mhklinux@xxxxxxxxxxx>
> > ---
> > I'm not aware that this bug is causing any real problems because
> > SEV-SNP CoCo VMs on Hyper-V are rarely, if ever, used without a
> > paravisor. But it was on my list of little clean-ups to do, and
> > a recent Sashiko analysis [1] flagged the issue. So the best thing
> > to do is just fix it.
> Reviewed-by: Tianyu Lan <tiala@xxxxxxxxxxxxx>

Applied. Thanks.