]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm64: entry: Actually skip do_trap_*() when an SError is triggered
authorJulien Grall <jgrall@amazon.com>
Tue, 6 Aug 2024 12:48:15 +0000 (13:48 +0100)
committerStefano Stabellini <stefano.stabellini@amd.com>
Wed, 13 Nov 2024 03:05:38 +0000 (19:05 -0800)
For SErrors, we support two configurations:
  * Every SErrors will result to a panic in Xen
  * We will forward SErrors triggered by a VM back to itself

For the latter case, we want to skip the call to do_trap_*() because the PC
was already adjusted.

However, the alternative used to decide between the two configurations
is inverted. This would result to the VM corrupting itself if:
  * x19 is non-zero in the panic case
  * advance PC too much in the second case

Solve the issue by switch from alternative_if to alternative_if_not.

Fixes: a458d3bd0d25 ("xen/arm: entry: Ensure the guest state is synced when receiving a vSError")
Signed-off-by: Julien Grall <jgrall@amazon.com>
(cherry picked from commit 35c64c3dce01c2d0689a8c13240bf48a10cef783)

xen/arch/arm/arm64/entry.S

index 6251135ebdd2f88de755c68d840eb18b216cf2e1..fab10f8a0d26e053e19b8e5f9734269c1925a7cb 100644 (file)
          * apart. The easiest way is to duplicate the few instructions
          * that need to be skipped.
          */
-        alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
+        alternative_if_not SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
         cbnz      x19, 1f
         mov       x0, sp
         bl        do_trap_\trap