From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.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 389CE3E9588 for ; Thu, 18 Jun 2026 12:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781785011; cv=none; b=eMBRAUIzhyUHVle22aW0c8622Q1rObdcEk8J5C9GeV6KUXCFjTfuRkXTHEE9tnkASN0db85hghIugB0JhMWGNGrjlYQ6kKxBm+wT2vWuQDSuX49HjSqIcPVHZCpXPbLrzcCqJ2f+KHnNy92cTecVOqFH/OexnaSdXr2cpDe/kCc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781785011; c=relaxed/simple; bh=5Di8q9yYpe7Ua8SDCZ8NXcwNMlvmGjo31kY4HzAzIv4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=jt3nKqHIuOpOBBL23s5jwYDUpW1c1tuNbcav/v2jxLL9MXdjxIZCAkIUfi8FUgLSy9ZsXm8S2lTp2t4c3WH3vnY0NkJnYg9+tZvhudZw7UkSmAfcORvRbMHYOZtu0B0oMq1fyp5sTol7ben93EfuOD48u6/GgHYbXAkjlgXtUZQ= 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=kVrc/UC1; arc=none smtp.client-ip=209.85.128.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="kVrc/UC1" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-490dad70f95so7988475e9.3 for ; Thu, 18 Jun 2026 05:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781785009; x=1782389809; 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=0CWrIkL6+XzrRSwpatYKrxag9f+rKkB9yY8JYBbAq+c=; b=kVrc/UC12MAZEnsbA6LULOSKlkvZ5Tf5cYKXJKWjwMioK+uQrEbXs3cwX6avBJ+lTa +UlXXfYeNSsxVncM7O4fhc6b2uJtp2pzJXGm/Z2oDDU5bvsbZAd9faHBmOcysfFH7Ejq +wQPiB7NP1fODtMWvTUiMyDocj0hgOvpndZlVDTmGs0pq6vWx20ornfG3HTuJPIyE7Ba ppesXDJ9aTRuyJ26s2YtBo+0xNIrcyy4PQ/VNpkpbccsdow+iei/8u1Fa6fUY2yAfrAA CCUwTLKLUOWumocGEHjnHEgjUwC3wMZ61zIX1S+2goEauRykWu1cyhbvnMHvsGRLlQnV 88jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781785009; x=1782389809; 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=0CWrIkL6+XzrRSwpatYKrxag9f+rKkB9yY8JYBbAq+c=; b=CbnsdT0W6ptAXDh2rSo64T4tT5yElv9HWkp41N7L5uIA4c39g0qpoocmGHRq4U5Kya 1PTJLw55j0RfW1dp0uxDOaJni+snIm3rJW3nMfkQcRsdVYXILxGfebiwKZdUYFPOGLtS fPZHO2Q94q7P83DsRK3DJj6bZ4KP9Cq+AqeFwW5kmXh35NzhyScrRJQz+UdF9J6rlc4N WMEoraFbrJsiOxyL2RwPvEuvSisc4sn5hiBEtqikt2jswlx/fsb7g1tb7HhUud1qpxSX h4aVdOPRu3Mrpq/Dy4GeiK+xu0ksNsorM5LTQqhDnpDbXe6JexHfBRhhdyBykAUGI0Eo jqew== X-Forwarded-Encrypted: i=1; AFNElJ+MH8I//YOESHV+Q6hOb9sxjVZMq8nsSbENR9t3aYvhyJvs1yBmAcOodNWz5XXDrsecRNzSa+TeVQPFPh4=@vger.kernel.org X-Gm-Message-State: AOJu0YwvBg3xbEoymueJQboukXTJkTdA7uk5BNnJZGWD29XNeOi1G6of HYOa93H1DjvJsNp1kdG17cVB0//FarAsFdm1uvPe0R4IVkl+HH8dOYDaeD0ofCR05F8fkvBDdIs D5A== X-Received: from wrme5.prod.google.com ([2002:adf:e385:0:b0:462:9324:e0bd]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4e92:b0:491:ba04:2ce4 with SMTP id 5b1f17b1804b1-4923410c35dmr117676115e9.16.1781785008175; Thu, 18 Jun 2026 05:16:48 -0700 (PDT) Date: Thu, 18 Jun 2026 13:16:39 +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-4-tabba@google.com> Subject: [PATCH v2 3/7] KVM: arm64: Unconditionally set IL for injected abort 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_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.1189.g8c84645362-goog