[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Assert in x86_emulate_wrapper triggerable by HVM domain


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Manuel Andreas <manuel.andreas@xxxxxx>
  • Date: Wed, 7 May 2025 18:36:15 +0200
  • Authentication-results: postout.lrz.de (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=tum.de
  • Autocrypt: addr=manuel.andreas@xxxxxx; keydata= xjMEY9Zx/RYJKwYBBAHaRw8BAQdALWzRzW9a74DX4l6i8VzXGvv72Vz0qfvj9s7bjBD905nN Jk1hbnVlbCBBbmRyZWFzIDxtYW51ZWwuYW5kcmVhc0B0dW0uZGU+wokEExYIADEWIQQuSfNX 11QV6exAUmOqZGwY4LuingUCY9Zx/QIbAwQLCQgHBRUICQoLBRYCAwEAAAoJEKpkbBjgu6Ke McQBAPyP530S365I50I5rM2XjH5Hr9YcUQATD5dusZJMDgejAP9T/wUurwQSuRfm1rK8cNcf w4wP3+PLvL+J+kuVku93CM44BGPWcf0SCisGAQQBl1UBBQEBB0AmCAf31tLBD5tvtdZ0XX1B yGLUAxhgmFskGyPhY8wOKQMBCAfCeAQYFggAIBYhBC5J81fXVBXp7EBSY6pkbBjgu6KeBQJj 1nH9AhsMAAoJEKpkbBjgu6Kej6YA/RvJdXMjsD5csifolLw53KX0/ElM22SvaGym1+KiiVND AQDy+y+bCXI+J713/AwLBsDxTEXmP7Cp49ZqbAu83NnpBQ==
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 07 May 2025 16:36:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 4/16/25 15:52, Jan Beulich wrote:

On 15.04.2025 23:52, Manuel Andreas wrote:
my fuzzing infrastructure discovered that an assert in
x86_emulate_wrapper is able to be triggered by an HVM domain executing a
specially crafted repeating movs instruction.

Specifically, if the emulation of the rep movs instruction triggers an
exception (e.g. by accessing invalid memory after some amount of
iterations), the emulation will be halted at that point.
However, the instruction manual requires that _some_ register state
(namely the updated value of rcx) shall be commited, whereas the
instruction pointer needs to be rolled back to point to the address of
the instruction itself. The assert checks for the latter. Problematic is
the fact that for these type of repeating instructions, Xen seems to
eventually just commit all register state when it encounters an exception:
If my analysis is correct, none of this matters here; the core emulator
is working correctly. Hence also why the in-tree fuzzer wouldn't have
caught it. Would you please give the patch a try that I just sent, with
Cc to you (sorry, the list archive didn't pick it up yet, hence no link)?

Jan
Sorry about the late reply, just got around to applying your patch a few days ago.

I verified that the provided XTF test does not trigger the assert anymore.
Moreover, I fuzzed the patched version for a few days and the bug (or possibly newly introduced ones) did not pop up, so I believe the root cause was fixed correctly.

Best,
Manuel




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.