From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (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 8C1AC3A6405 for ; Sun, 14 Jun 2026 16:33:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781454822; cv=none; b=Vvj3DbaDTSoJKNN97A5NgtOZ7wsFUlgMbvzY5BFmyDeiI7OR1gYDoHEsIZTVig6nfprDzxDpRvWpMQXBNZbBwEaUj8yIjui6Cyl2IcgioGxFpdVh5zof3UJ+UW4u2KO1zNdxLE5An2SqfflIFkisRsfxml6YwsHNh48+tpmrO48= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781454822; c=relaxed/simple; bh=S+ANIzhr+1I2ni2Ik563AGs53yzGHssDeuVeRRuhqk4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VcC1XaA59BZhWdp1ZV86Ieh52Cf6PY2pEaUhdDY57iHbk+BBCSaLtFTzAEc3QnKV6WJ6qNEh36aEIaBfHk6kiAi3CMlwLeVKUFAJhikNH8eRQbdf6V8ZkQuLVJEiDtR8j6cOvy08Md81NJslJXRnuAxieGCF9rIvzE/cW+OcAB0= 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=Els/lTAg; arc=none smtp.client-ip=209.85.221.73 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="Els/lTAg" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-45ef2bd566bso1468309f8f.0 for ; Sun, 14 Jun 2026 09:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781454820; x=1782059620; 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=Z1TuWrlseib9lZt4HAdFooYmABBxqslHnBMn4+TnN7o=; b=Els/lTAgCA3ilhrnO2xvbU68byeKINah4ls5LXm5/rcg5YYc0nvYkVV0CeR+ff07Ad XKOUQDOz7MVwaHgvw7daTcL8ROeSPNKjVdKuemjclOIPPzoKIYq/LcLKzvqITkS0z/PN P0RedIG8J8echFM93OrSFmXIolR4RWG6B2kzJBrNRZooopsvp67A7tq2pzdUAyYN8ogx 7sgKtWa3HPz+HgxtimSmIGiyxCsQd+1FJCIHET9XpQ7Y99VBG9nlc37zjt3+4UqO1AMp DOi1YQZEIqDUDkRYXbesdDVH0+tddJiibnWvvaXok0L2p0kaSUPmOmppNQIPbX0p5KIM Ubjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781454820; x=1782059620; 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=Z1TuWrlseib9lZt4HAdFooYmABBxqslHnBMn4+TnN7o=; b=rPm91/0nxE7Gpw2fM47mMKDE3aBlDwUaaou5AlaiZXa5Q209D+Oi1ZlKjqj5kzc+uT 8Sa5w2xQj4hTKjM0SKXYvoeLQKulm/mvNsfTnl1Hz6N4SAaOI+IVJ+VUiFhoZ5g778xC UTbSiUPtRBlm4p7G4gis2qMS6HcKvGRqhiWeYg9rFYeC7adYOGQCEHi0Nub8LNOBuFEw AwtflcgQAD6bwn+iKelJDHrCLbtaxbHu3/MlAYp6NtYKy4XNkliiW2nCropESGSmvEnK ZUii4dSatKb50f6Zb4Rl9UFqlZkpOPVi69p4EJNWT3NM0Xx4CIagY/dof4yjr9MxzGox UrwA== X-Forwarded-Encrypted: i=1; AFNElJ/KTihjTynGmclrCPUiIq3tGtzpdpIGOve76aZYw7MZNAr5MaZl98xWzphfLpC7iQYo0eomD7ZBX1IXpzs=@vger.kernel.org X-Gm-Message-State: AOJu0YwncPt9Kgao436zwhgsUsbE9li4EUyxIGj9XAjUbj0sntXp4d2m 1I9qbC5hyyul9jv33BEB/AdYilOBViIjTy/yDy0RlpQ3O2kz6fx8nwmWQEqpe3JziSaJ5hvfGee EcA== X-Received: from wrmc12.prod.google.com ([2002:adf:e70c:0:b0:460:18fc:1a70]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:288f:b0:460:13db:4a03 with SMTP id ffacd0b85a97d-46074a5289amr8873252f8f.7.1781454819748; Sun, 14 Jun 2026 09:33:39 -0700 (PDT) Date: Sun, 14 Jun 2026 17:33:31 +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-3-tabba@google.com> Subject: [PATCH 2/7] KVM: arm64: Unconditionally set IL for injected undefined 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_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.1136.gdb2ca164c4-goog