From nobody Thu Nov 21 20:15:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1722948531; cv=none; d=zohomail.com; s=zohoarc; b=FH5n6Khx3Qiq7+r8s9fS2vlQtBdFgy9OlbaE5ygPaq6/9p2zxBwogXq6GVmWRy0JzJyrNidlqUK0zpVXyCW9RJx4WrruFLnYdsBDnoAX/sY24fl4PAzUV00HDuLugSq8yegEFHb+sBrF3a7FvzrUCHxluAH6wiiJq01y4UcVtMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722948531; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bgtg7AJNCNjW0PVNQtg8CBjCCHn+6JUhVvhjRrYGPYw=; b=dvK6hcKq8uAzte/BtTpJPZ3tOK7jUMguTqu3qAI4cUgc7yAk2UhxiWF65QtqjK7nj2q0EWoIODucnFXb6Wu5/2gIInsLD0d5Cax++z4ShxQIkonLErb3sdUrFYUmbp3VVyofe65Tq9n5rypvTyLvYICo9tu3NLPfT8gVBJkaIN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1722948531311158.36178641866752; Tue, 6 Aug 2024 05:48:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.772868.1183303 (Exim 4.92) (envelope-from ) id 1sbJc0-0001ao-Ce; Tue, 06 Aug 2024 12:48:24 +0000 Received: by outflank-mailman (output) from mailman id 772868.1183303; Tue, 06 Aug 2024 12:48:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sbJc0-0001ah-9P; Tue, 06 Aug 2024 12:48:24 +0000 Received: by outflank-mailman (input) for mailman id 772868; Tue, 06 Aug 2024 12:48:23 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sbJby-0001ab-Um for xen-devel@lists.xenproject.org; Tue, 06 Aug 2024 12:48:23 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sbJby-0005fo-72; Tue, 06 Aug 2024 12:48:22 +0000 Received: from 54-240-197-232.amazon.com ([54.240.197.232] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1sbJbx-0007eA-Rr; Tue, 06 Aug 2024 12:48:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From; bh=bgtg7AJNCNjW0PVNQtg8CBjCCHn+6JUhVvhjRrYGPYw=; b=pR0obT hKWc8nKwnes/f4MHLQ48aIJgvOyHGUy8cUPdGKjHyx+x0Y95/bQfQL9e2g75Ax6PRZUZgpSTBZgeu hwggwo+Sot6M+EucjSv61TmwP7OkyWAxDVow/TVm/yeui5PkRHEV0Y5QKKacnV/8bbqF0jYYyu8Br nozNNk0SSwU=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH] xen/arm64: entry: Actually skip do_trap_*() when an SError is triggered Date: Tue, 6 Aug 2024 13:48:15 +0100 Message-Id: <20240806124815.53492-1-julien@xen.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1722948533124116600 Content-Type: text/plain; charset="utf-8" From: Julien Grall 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 Acked-by: Michal Orzel ---- This is a candidate to be backported to all supported tree. I don't have a setup where I can easily inject SError. But this was tested by setting x19 to 1 just before the first alternative and use "serrors=3Dpa= nic". Before this patch, Linux would get stuck. --- xen/arch/arm/arm64/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S index 6251135ebdd2..fab10f8a0d26 100644 --- a/xen/arch/arm/arm64/entry.S +++ b/xen/arch/arm/arm64/entry.S @@ -259,7 +259,7 @@ * 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 --=20 2.40.1