Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18D85C3ABBF for ; Wed, 7 May 2025 16:36:53 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.978685.1365492 (Exim 4.92) (envelope-from ) id 1uChl0-00023L-IF; Wed, 07 May 2025 16:36:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 978685.1365492; Wed, 07 May 2025 16:36:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uChl0-00023C-Fl; Wed, 07 May 2025 16:36:30 +0000 Received: by outflank-mailman (input) for mailman id 978685; Wed, 07 May 2025 16:36:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uChkw-00022u-Gg for xen-devel@lists.xenproject.org; Wed, 07 May 2025 16:36:28 +0000 Received: from postout2.mail.lrz.de (postout2.mail.lrz.de [2001:4ca0:0:103::81bb:ff8a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 678b87d0-2b61-11f0-9ffb-bf95429c2676; Wed, 07 May 2025 18:36:20 +0200 (CEST) Received: from lxmhs52.srv.lrz.de (localhost [127.0.0.1]) by postout2.mail.lrz.de (Postfix) with ESMTP id 4Zt19b4rqLzyVT; Wed, 7 May 2025 18:36:19 +0200 (CEST) Received: from postout2.mail.lrz.de ([127.0.0.1]) by lxmhs52.srv.lrz.de (lxmhs52.srv.lrz.de [127.0.0.1]) (amavis, port 20024) with LMTP id CZEc8HSAboKw; Wed, 7 May 2025 18:36:18 +0200 (CEST) Received: from [IPV6:2a09:80c0:192:0:1a32:faf8:4a92:5176] (unknown [IPv6:2a09:80c0:192:0:1a32:faf8:4a92:5176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by postout2.mail.lrz.de (Postfix) with ESMTPSA id 4Zt19Z3R7RzyW6; Wed, 7 May 2025 18:36:18 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 678b87d0-2b61-11f0-9ffb-bf95429c2676 Authentication-Results: postout.lrz.de (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=tum.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tum.de; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :user-agent:mime-version:date:date:message-id:received:received; s=tu-postout21; t=1746635778; bh=rMTiElN/AF1fB/6uRBfuCtNtyx4lm1 x0wHJXW+k9zL0=; b=lx2eFH5IfViNfFD8O9cb0DpoWID4hx2PEVqHQoqY5faNUN S2R81a90W78TyybFqdTn5W4e99zQx94jkEfbUmoZatArMBufiWUNNdma7cqQo5vb 7k2ziPn08zrjB5B0qxNGo8jHNveiBzupiQ/+4e3gpULdtvM7+uK+oWnk9ZQgysNU Zx+X0qOnUCX2HGmT6ys8/w0c0YQLFwYumackprw4Xhd08fVb1i7EewhAlU7teA4i qlcJ2ZYQiDiYDLkgYm7+17AYtBKZaQaUY3z32eS2Il3hJUIRr0nMCX/0s4MN0797 B3gGBnIiIluRTmADj3JzWzuE/IYAkWGzdpyvbBTA== X-Virus-Scanned: by amavisd-new at lrz.de in lxmhs52.srv.lrz.de Message-ID: Date: Wed, 7 May 2025 18:36:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Assert in x86_emulate_wrapper triggerable by HVM domain To: Jan Beulich Cc: xen-devel@lists.xenproject.org References: <26f9b5dd-2201-4dd7-bf26-863a9b114b62@suse.com> Content-Language: en-US From: Manuel Andreas Autocrypt: addr=manuel.andreas@tum.de; keydata= xjMEY9Zx/RYJKwYBBAHaRw8BAQdALWzRzW9a74DX4l6i8VzXGvv72Vz0qfvj9s7bjBD905nN Jk1hbnVlbCBBbmRyZWFzIDxtYW51ZWwuYW5kcmVhc0B0dW0uZGU+wokEExYIADEWIQQuSfNX 11QV6exAUmOqZGwY4LuingUCY9Zx/QIbAwQLCQgHBRUICQoLBRYCAwEAAAoJEKpkbBjgu6Ke McQBAPyP530S365I50I5rM2XjH5Hr9YcUQATD5dusZJMDgejAP9T/wUurwQSuRfm1rK8cNcf w4wP3+PLvL+J+kuVku93CM44BGPWcf0SCisGAQQBl1UBBQEBB0AmCAf31tLBD5tvtdZ0XX1B yGLUAxhgmFskGyPhY8wOKQMBCAfCeAQYFggAIBYhBC5J81fXVBXp7EBSY6pkbBjgu6KeBQJj 1nH9AhsMAAoJEKpkbBjgu6Kej6YA/RvJdXMjsD5csifolLw53KX0/ElM22SvaGym1+KiiVND AQDy+y+bCXI+J713/AwLBsDxTEXmP7Cp49ZqbAu83NnpBQ== In-Reply-To: <26f9b5dd-2201-4dd7-bf26-863a9b114b62@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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