From: Nuno Das Neves <[email protected]>

[ Upstream commit 4cd661c248b6671914ad59e16760bb6d908dfc61 ]

This field is unused, but the correct structure size is needed
when computing the amount of space for the output argument to
reside, so that it does not cross a page boundary.

Signed-off-by: Nuno Das Neves <[email protected]>
Reviewed-by: Michael Kelley <[email protected]>
Signed-off-by: Wei Liu <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---

LLM Generated explanations, may be completely bogus:

YES — The change is a low-risk ABI fix that prevents a real functional
hazard for the new Hyper-V root-partition path.

- `include/hyperv/hvhdk_mini.h:302-305` now models `struct
  hv_output_map_device_interrupt` with the host-defined
  `ext_status_deprecated[5]` trailer. Without those 40 bytes we under-
  represent what the hypervisor actually writes back for
  `HVCALL_MAP_DEVICE_INTERRUPT`, so callers reserve too little space for
  the result.
- `arch/x86/hyperv/irqdomain.c:21-64` takes the shared per-CPU hypercall
  output page (`*this_cpu_ptr(hyperv_pcpu_output_arg)`) and hands it
  straight to the hypervisor expecting exactly `sizeof(struct
  hv_output_map_device_interrupt)` bytes of room. With the old, shorter
  definition the host still stores the extra status words, which can
  spill past the area the kernel thinks is free and into whatever other
  data has been staged in that page, triggering hypercall failures or
  corrupting later outputs.
- The shared-page allocation in `drivers/hv/hv_common.c:470-498` makes
  this especially risky: every root-partition hypercall in the kernel
  reuses the very same page, and several (`hv_call_get_vp_registers()`,
  `hv_call_get_partition_property()`, etc.) rely on the struct
  definitions to know how much of that page is safe to use. On big
  systems where the IPI/vpset variable header already consumes most of
  the page, the missing 40 bytes are enough to push the returned
  interrupt descriptor over a page boundary, at which point Hyper-V
  rejects the call with `HV_STATUS_INVALID_PARAMETER` and MSI setup in
  the nested root partition fails outright.

Given that the regression was introduced with the new root-partition
headers (commit 0bd921a4b4d9c) and the fix is confined to restoring the
correct ABI layout, this should go to stable kernels that carry the
root-partition support. After backporting, run the Hyper-V root-
partition interrupt mapping or nested MSI smoke tests if available.

 include/hyperv/hvhdk_mini.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hyperv/hvhdk_mini.h b/include/hyperv/hvhdk_mini.h
index 42e7876455b5b..858f6a3925b30 100644
--- a/include/hyperv/hvhdk_mini.h
+++ b/include/hyperv/hvhdk_mini.h
@@ -301,6 +301,7 @@ struct hv_input_map_device_interrupt {
 /* HV_OUTPUT_MAP_DEVICE_INTERRUPT */
 struct hv_output_map_device_interrupt {
        struct hv_interrupt_entry interrupt_entry;
+       u64 ext_status_deprecated[5];
 } __packed;
 
 /* HV_INPUT_UNMAP_DEVICE_INTERRUPT */
-- 
2.51.0


Reply via email to