From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 158FD398902 for ; Thu, 18 Jun 2026 12:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781785010; cv=none; b=atc5XRsrgDEmy/Q8yfSR3+biwNr5aOa8x9tbY8wd66DeNRsoHxB+CpFDOdP6cDqDiMjJqWjOL6ltaqZqAPXfjam/zjSbECeeTNnWIr0wU3GZ1XaNoB62RIHFYwM+zAllNz2wLFhjWBwr5VJXnekVeiRBuydpaQLBUcwNq9n//2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781785010; c=relaxed/simple; bh=waaYT4/DFUf9UowO2Osfh/Wu/cdI6fDHVQqOxUVGlxw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=sfwS94cGs0iKy+Gj/ZVNqh6tvdVODE+qZxqaf8RZu0wVWy9VUB0H5nHe5mljRcvyzEvLLP4KCsqleKUkCm7tfwOA/5rbiaReZ4kI/k6PEioWr6eSJPqvRteQ6zD+QmgvyBTkflJL7bQWVvoNJTxLdFwisLsoFqWEUznwaYxnXA8= 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=PPU0R2zR; arc=none smtp.client-ip=209.85.221.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="PPU0R2zR" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-45efb6e60e4so961354f8f.0 for ; Thu, 18 Jun 2026 05:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781785007; x=1782389807; 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=rqX7MefVbPP0W7Hi9ByJyRvIz6FhPEE0my94/je5OUw=; b=PPU0R2zRpErNFupqaicQSnxvPBe8EYoyAKuTxEvh45gYaFnE0n+1mAcLa8xZ1/t6G9 z61x/12ho75XC5wpILUKOmtXq8GU62r7c+XyX9o1SS2LVwHradSfqFnbiYUPr+1bJIH7 b2PJI/Fy/Mxk97V4ni/zvXHDvLKY5uEzGzUXCx1IzykXOVEC5L0LuMM+F5sZSP9hfJjj f52ruFQw2DzC3KtSufGgxs1SuLnKLobaMfHGIeIVqgbn58LhPCv1fMgR76txEILCl+O3 DNYwTFaqFB/Bpy2yTtxPg2bJ5bxK6C6q/7Exlki4k+X/dO4ssjyuNh5jsXPytHgaWS/m qZrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781785007; x=1782389807; 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=rqX7MefVbPP0W7Hi9ByJyRvIz6FhPEE0my94/je5OUw=; b=HVAjTE2Pcz7Qc8wV3UQILwLOruxOB/qi16rVTooGRTq5S+ANhwB671RnSml9tmwkxO p5uHjHlW8FzVdGYTwcK0TZUccA5w1RxS0aP7gMj6nYt2eXFvBtv6jwm2BnvOBOMpuArs QNmQJec46qDc7OIIZ4W++pI6BX0pSq3ORJg/CBjU4NXv6UJ5zbremGkFb2UPdrt7gc0/ balLKyluZHrImn4vOBbwgTHSAQzk6b/GR6ssAhfEq9RnVlfgseLdAvn/CxzegFsdJ9mM tvCuIthBcZnzbQEFtR/XxE16GccZjcyQeRPt0zO9dF8ye8Mzom17ZBObXkhCZQjPqdNP NWgw== X-Forwarded-Encrypted: i=1; AFNElJ8scvM9ZWYn33Mv+3DywAJ0LfQKWfLZgkvwDQS3eeXWroCa+sWJgszrPVbiUedsyREnO5Vae4Of7IUucQI=@vger.kernel.org X-Gm-Message-State: AOJu0Yzrn8REMwi2Q3vA6twCCtQUHAEIFK2cvPiP2fy8fUYO9PrplbHT YQEFPchCecbEB3JUPOQ8k0C4ll+3Xbkb8NZX8dpnV0RUyTmzGX0aFfC4XQtIWiyYYOHKZlmECBl zNQ== X-Received: from wrvz3.prod.google.com ([2002:a5d:6543:0:b0:463:7bed:40ab]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a5d:5390:0:b0:45e:eec6:5020 with SMTP id ffacd0b85a97d-463ae25709dmr3971523f8f.38.1781785006903; Thu, 18 Jun 2026 05:16:46 -0700 (PDT) Date: Thu, 18 Jun 2026 13:16:38 +0100 In-Reply-To: <20260618121643.4105064-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: <20260618121643.4105064-1-tabba@google.com> X-Mailer: git-send-email 2.54.0.1189.g8c84645362-goog Message-ID: <20260618121643.4105064-3-tabba@google.com> Subject: [PATCH v2 2/7] KVM: arm64: Unconditionally set IL for injected undefined exceptions From: Fuad Tabba To: Marc Zyngier , Oliver Upton , Catalin Marinas , Will Deacon , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Vincent Donnefort , Sascha Bischoff , tabba@google.com Content-Type: text/plain; charset="UTF-8" inject_undef64() derives IL from the triggering trap's instruction length (kvm_vcpu_trap_il_is32bit()), but the IL of the injected exception is fixed by its EC, not by the triggering instruction. The architecture mandates IL=1 for EC=0 (Unknown) unconditionally, so the conditional is wrong. The undef-injection paths are not reached from 16-bit instructions, so there is no functional change today, but the logic should not rely on that. 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 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c index 89982bd3345f..9dfae1bcdf99 100644 --- a/arch/arm64/kvm/inject_fault.c +++ b/arch/arm64/kvm/inject_fault.c @@ -170,14 +170,7 @@ void kvm_inject_sync(struct kvm_vcpu *vcpu, u64 esr) static void inject_undef64(struct kvm_vcpu *vcpu) { - u64 esr = (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT); - - /* - * Build an unknown exception, depending on the instruction - * set. - */ - if (kvm_vcpu_trap_il_is32bit(vcpu)) - esr |= ESR_ELx_IL; + u64 esr = (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT) | ESR_ELx_IL; kvm_inject_sync(vcpu, esr); } -- 2.54.0.1189.g8c84645362-goog