From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 787C43CAA3E for ; Sun, 14 Jun 2026 16:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781454823; cv=none; b=RdBgtL7+siEuvrW6IUtqhr1L0GCEgy6As5nbz6a5oWAap9PfdRyk38IH21YDmoyfmlCt1crYTcpqjQmFS0E9ayBk8vC/6q6o3fuD3tQsvFmzr5HzpvUbGS6icQiEPCyGbqoTwH1rcSkDtvgsjRwdlUtit9p/KO1F26wp55IxZJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781454823; c=relaxed/simple; bh=A2AhPH+33IQk5h5kTOaTRTDdWlQAO0nttY9d2WHTjzg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=pxJ9gr8Zz/bFFEVp7T7DhCwZRK8OnE0F4uqr4JhpiIpV3BT69tDJpPChmpVGCY0Gd32gtnzaoWyXy5w1ky/kpmF6cv5UfgTQM0BaB1zl8SJ/OmUaV5ORqpuH/oZ9zSSTye1w7v/k5DMpmirvqnvLxWmu/ggI+BDUe+gqMnTQP7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--tabba.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Q/JyOBuY; arc=none smtp.client-ip=209.85.218.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--tabba.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Q/JyOBuY" Received: by mail-ej1-f74.google.com with SMTP id a640c23a62f3a-bebbba3c343so154656366b.0 for ; Sun, 14 Jun 2026 09:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781454821; x=1782059621; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pUEfSSWjUxPUEBOeVgJgGyeprvmKo0fkBhbWmKqUI0k=; b=Q/JyOBuYGfAqzqOdMjCNYEQA1EbBCgxVWDWhEEEDeNJCPYIUKSPySzYE5+UGZZP5WK GpiN3rVBXXM2cy2UqBs6xHnWbTPPi9FyEKYvAWpOhv3qXRtA40ofc2KRLIGN2TOjbStu nuTlR2OZFbWMPXK2AXOiXY80KsAa2MPdQ1cko4FANRlrN2fgzzfpOIVMDh2NPCN6LyQy KhXbqvSloiyjD9oR/3Mtmt0jpXugb2PHLMN5cseo28p2n+g/PZ6cTcql1ZlUcA6qUEZe EarUNRARxX4BAaAupr95ocoiFy2uDht9UZg4JR7dUz5Ze98QIBc2Q6xvd/madn56pFQp qhbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781454821; x=1782059621; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pUEfSSWjUxPUEBOeVgJgGyeprvmKo0fkBhbWmKqUI0k=; b=Fry0pPGPBuN7bizsq+gipEFvzyIMygAAxAwW/bmpbeAkBBYC3JB90n8wQQe3D0xuMd RxUY/OZ5kDrTqJmkhWnA6oD6ymWyASyl3SgicUEJStaAL2aHCOrxWXAmzj5P0J+0MJQj qQgLkeqBpc//YW9CqDFTT9kly2+Q/YV3Ukag6qbEO1Z45Quh+SvIiHuLBYViwBIILwkC FgG+2rohb8Mrbl+75pQYF+SPiNG6znxxQt8Q5jZtX350ong4ZShgk/kDFUxyu/D9ep7c NNM5zM+L16M8X+xiGFUR8UxO2aif9A9IvYLslk5fweQxLDPooPc4aP5mDogPuWFgHQn8 xacA== X-Forwarded-Encrypted: i=1; AFNElJ9ZE1qGwQRAO2uBbs9SGbpDN8bPF6uO00Z4YJnChEsCwAKLfDw7KBX+n+h97UZyBGko59Qgu48JIsiaUt4=@vger.kernel.org X-Gm-Message-State: AOJu0Ywx6MwEZhNgnDdZtPn1X8G2g4yL/Y2jPtSJHfVC3yAg/sgehKgO FwEt0vVauBQhbaGNny4iXtVfDtB/BVl0pZXM6P8KCz1QW6sYxrCT/3tQHrnn1NblqLUZHlIikod Gbg== X-Received: from edl15-n1.prod.google.com ([2002:a05:6402:424f:10b0:67b:f7e5:4f5f]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:7ba2:b0:bee:9809:3ccd with SMTP id a640c23a62f3a-bff499220e7mr377106666b.4.1781454820693; Sun, 14 Jun 2026 09:33:40 -0700 (PDT) Date: Sun, 14 Jun 2026 17:33:32 +0100 In-Reply-To: <20260614163336.3490925-1-tabba@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260614163336.3490925-1-tabba@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260614163336.3490925-4-tabba@google.com> Subject: [PATCH 3/7] KVM: arm64: Unconditionally set IL for injected abort exceptions From: Fuad Tabba To: Marc Zyngier , Oliver Upton , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Vincent Donnefort , Sascha Bischoff , tabba@google.com Content-Type: text/plain; charset="UTF-8" inject_abt64() derives IL from the triggering trap's instruction length (kvm_vcpu_trap_il_is32bit()), but the IL of the injected abort is fixed by its EC, not by the triggering instruction. The architecture mandates IL=1 for Instruction Aborts unconditionally and for Data Aborts with ISV=0, and this function never sets ISV (the FSC is always EXTABT or SEA_TTW). For a 16-bit T32 trap (a 32-bit EL0 task under an AArch64 EL1 guest) the trap has IL=0, so the abort is injected with the wrong IL. Set ESR_ELx_IL unconditionally. Fixes: aa8eff9bfbd5 ("arm64: KVM: fault injection into a guest") Signed-off-by: Fuad Tabba --- arch/arm64/kvm/inject_fault.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c index 9dfae1bcdf99..444d219b0217 100644 --- a/arch/arm64/kvm/inject_fault.c +++ b/arch/arm64/kvm/inject_fault.c @@ -138,11 +138,10 @@ static void inject_abt64(struct kvm_vcpu *vcpu, bool is_iabt, unsigned long addr pend_sync_exception(vcpu); /* - * Build an {i,d}abort, depending on the level and the - * instruction set. Report an external synchronous abort. + * Build an {i,d}abort, depending on the level. + * Report an external synchronous abort. */ - if (kvm_vcpu_trap_il_is32bit(vcpu)) - esr |= ESR_ELx_IL; + esr |= ESR_ELx_IL; /* * Here, the guest runs in AArch64 mode when in EL1. If we get -- 2.54.0.1136.gdb2ca164c4-goog