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 4D4491922FD for ; Sun, 14 Jun 2026 16:33:39 +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=1781454820; cv=none; b=Uao2ooxgUkkZPaVLMQyNV/Ud4VWBz1INojRYPFZDhoeB4RRxkHuxhUgXGLWBtdDQYUb+uomJ0/hyIuW5T+gHvJA1prnV+R/LqXXWbQcxpJtRnWnFzCtx050Z96HnIamvFbylN7NHD0Xwwow1HzBdXuBme/ANdAvG+8N8OVftz5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781454820; c=relaxed/simple; bh=iIjH5h06cGBmKEwS0baZNP6y+X5SmfaIo9y8hX3w30c=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=YuNyYkw1JQ9178V5vMOE//t89+Gjl78ypDNWXiG8E6b5Ob0cJ42bO1u1r7gGr2btj8zxXe++A36ZJUHvwJXxfCiW5dvmyFqywvVDiipEoY7BMfQzr6VgJ3GG/jmiOpDNgBFS69GThQ6G1UpK2aonGtJLZLevEeK1dmuQtFP9fHU= 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=nKZWLK3F; 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="nKZWLK3F" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-46067399d5dso1118283f8f.2 for ; Sun, 14 Jun 2026 09:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781454818; x=1782059618; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=wF52xqv2gt97ZmYG5q8RS9QpeTQBkGWbTxMLhSV4/qM=; b=nKZWLK3FNtDYrO17qZJApE7heyo5To26zr57edzYpXFDPaSxa74rtAOTzwJV78DPxr g6ZkXINq3KprhUhlEDP45PebgZ/+LgJHYy9W/Rkx/6v3aIwKH1vaQb11Cdqa702z41cW AJJHEf46ZJsdPMVTbNJo6m1LkfKA0nG6KueNvzEuerrCV8foFJOdVa+j7uSco5lNjGl2 RVZFL0X5W3XSwbaKK4gJrCbtPTO+mItgZz5sUmh7NspavyMaJnD+pohez/yD3mJoJLYb Dpasva5RtRPJc66Dno55Gfhd02VfyfwkeVOnRFv3owUKD+m+LfXNf2U/oA5srS9tGNrN DWcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781454818; x=1782059618; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wF52xqv2gt97ZmYG5q8RS9QpeTQBkGWbTxMLhSV4/qM=; b=MoOHoMlSJmA4yQv6REIdQYd6Q+p+N/rOW0NA8CiT8iBPQBZjIlfmbe1EqWNIx76jxL jovU0cTqZ8UvN/18S/LOCtyak2PQ9rtcLaiy5D2nMh4D9f3qpqR2dkVPcGsEqCMt4Ive Sr0l80FFNKxq9YYSrI6HjSVwRMvAUp6xLX84Zx9hydTs0sca9yHGjTXRRh2yaeRBnID1 pPQhKHLNVQzNjsRxhVPxqX7iGmpybT74gNzOy1AFQp9Dy3q6Jhdn5qq33kq1yMjx7XDR aoUNDFHliHx7Bp7yJebYZHbguCyLAeNGrHx8wWisxalz7i+RCbtuR/246jlJlkh10Oef NO/w== X-Forwarded-Encrypted: i=1; AFNElJ+ZXE0bDj5ByLsZ/vCMlCRh1zGEP5kVS+ltgtCk5r4OxYcoL220YV4LNRIc4vIXco9iZ21XatJwD37ewMM=@vger.kernel.org X-Gm-Message-State: AOJu0YzMD31POD/0oXD/blGNJ6MejEKWNr0u9Oi8XOX3/Maip4Z8BdNy 9VMOYR3nbJSEk1yD+Ik+aKfk+lb4iA58620yBz3pm6iusr7k9cu/WYZroj1EImzXWCUjabPDwSr 1ig== X-Received: from wrnv4.prod.google.com ([2002:adf:ebc4:0:b0:43d:733a:c37e]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a5d:6f1c:0:b0:448:7049:a6c9 with SMTP id ffacd0b85a97d-4606da5a49dmr14309136f8f.5.1781454817370; Sun, 14 Jun 2026 09:33:37 -0700 (PDT) Date: Sun, 14 Jun 2026 17:33:29 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260614163336.3490925-1-tabba@google.com> Subject: [PATCH 0/7] KVM: arm64: Fix missing ESR_ELx.IL in syndrome injection 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" Hi folks, After sashiko caught the missing IL bug [1], I did an audit of all ESR syndrome construction sites in KVM/arm64 as Marc suggested. This series is the result of that audit. The ARM architecture mandates ESR_ELx.IL=1 for several exception classes regardless of instruction length: EC=Unknown, Instruction Aborts, Data Aborts with ISV=0, and SError. For FPAC (EC=0x1C), IL reflects instruction length, but FPAC can only be generated by A64 instructions, so IL must also be 1. Patch 1 is the bug sashiko found: inject_undef64() in the pKVM hyp (EL2) path never set IL. Patch 2 makes the same fix to inject_undef64() in the normal host path, where IL was derived from the triggering trap's instruction length. No instruction that reaches undef injection has a 16-bit encoding, so patch 2 has no functional change today. Patch 3 makes the matching fix to inject_abt64(). Unlike undef injection, abort injection is reachable from a 16-bit T32 instruction (a 32-bit EL0 task under an AArch64 EL1 guest), so the old code there injects an abort with IL=0. Patch 4 fixes the FPAC syndrome constructed during nested ERET emulation, which did not set IL. Patches 5-6 fix SError injection in the emulated and nested paths, neither of which set IL. Patch 7 fixes a fake ESR used to exit to the host. The host does not read IL there, so it is not guest-visible. Based on Linux 7.1-rc7 Cheers, /fuad [1] https://lore.kernel.org/all/87pl1t8q24.wl-maz@kernel.org/ Fuad Tabba (7): KVM: arm64: Set ESR_ELx.IL for injected undefined exceptions at EL2 KVM: arm64: Unconditionally set IL for injected undefined exceptions KVM: arm64: Unconditionally set IL for injected abort exceptions KVM: arm64: Set IL for injected FPAC exceptions during ERET emulation KVM: arm64: Set IL for emulated SError injection KVM: arm64: Set IL for nested SError injection KVM: arm64: Set IL in fake ESR for pKVM memory sharing exit arch/arm64/kvm/emulate-nested.c | 4 ++-- arch/arm64/kvm/hyp/nvhe/pkvm.c | 3 ++- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- arch/arm64/kvm/inject_fault.c | 18 +++++------------- 4 files changed, 10 insertions(+), 17 deletions(-) -- 2.54.0.1136.gdb2ca164c4-goog