From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796295511; b=hdVJxIOoFkkzaqTL8b5jGneZxG2lClpp+u36eb6Al7zGxlFU+XPQ+m6NJMHlpz6MbSJG k8qKHUJEEz6mvOhUnvpoUKnOdd+sTA5V+tp0fSHSS1u37wxj75RvqKrKOEv4Ay/tDnht+ GBiMLXcqMbAq7HdglRmCVIgcMZDkoEBgpXsXQCpZIS8Mr3GuSOYppOukapdOuIVrdD3Lt +zRrgosLWlVZbJF9RAJyUa9DKGmkextWpG8ZKeiw7CcphjN9VNQYrdTLKw5ZDBpm1jD99 2uj0OnW/ub/M8H+rp1WFrDcALB0pOLeR1tk9bch0m0x03fG1WTt+/7cdI5z9M4GbbKg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796295511; h=DMARC-Filter:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=4Lp7ZW8J64ICiVpLClumxoxf3Zg+dHdAwNNecQocHO8=; b=oRIKBhjSKdPalU33SqdIcE1hWaKXj8Wu3v9KWHxj26ueaQKofsUwz9yY2io5g2Eb4ULw EMC//lWeHB0Mj+eu9HOjF3SxF3/5de8HV2BPBPWMi9BnyuF28ghsR3aGURak2dOleqSBt /55iWug79mZ2wKmrwlDJdzP3I7z2XBftbGjL6sxBc3qdeuIdZzVmsHbhrWY10c8T//3mV pDY7oW12Irkh5eutSQTRp394i4HutiySj2TQQv7oYWv1qMhgsIOEKh+i+uA5CFSEQwR8w UMGXKt4E2H0kz2QnBb2VbjMv483GEccN65WPXONaCnY1Pghqb/0RnWKdVGvso4UuXkw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=jFWoDIy1; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 524E7606A330; Thu, 3 Dec 2026 10:58:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 524E7606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=jFWoDIy1 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 994F61477; Thu, 3 Dec 2026 02:58:27 -0800 (PST) Received: from entos-yitian-01.Arm.com (unknown [10.168.196.233]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 808383F86F; Thu, 3 Dec 2026 02:58:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796295510; bh=gJQ8p+i2KKlxw/ot5zevr33Usf3bB+aHRTMWC5igFNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jFWoDIy1WzBzl1jsGYN3WyuWLhpnh/x1WRWbyBe0EXSmBumLx2KMe2WvOXAesIxZB YFF3jKkYwn2JT5QqX8OpUrP3Har9VXjSFczot4ob1BhzxlgNuXu04QOwPAGgW7TYde l4spkkhda4A1iuP+dEVUb0UtGZbniQQcHOz7prOE= From: Jia He To: Marc Zyngier , Oliver Upton Cc: Jia He , Fuad Tabba , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Paolo Bonzini , Sean Christopherson , Shuah Khan , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Sashiko , Yuan Yao Subject: [PATCH v4 2/4] KVM: arm64: nv: Inject an SEA when the VNCR walk cannot set the AF Date: Thu, 3 Dec 2026 10:58:03 +0000 Message-Id: <20261203105805.165749-3-justin.he@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261203105805.165749-1-justin.he@arm.com> References: <20261203105805.165749-1-justin.he@arm.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit With TCR_EL2.HA set and AF clear, the VNCR stage-1 walk tries to update the leaf descriptor. If the table is in a read-only memslot, __kvm_at_swap_desc() returns -EPERM and walk_s1() records an SEA on the table walk. The VNCR walk uses the EL2&0 regime, so nested stage-2 permissions do not enter into this case. kvm_handle_vncr_abort() ignores -EPERM and re-enters the guest, which takes the same abort again. Handle -EPERM and inject the recorded SEA. On Neoverse-N2 the unpatched case took about 1.3 million exits in five seconds. With the fix the guest received a level-3 table-walk SEA. Reported-by: Sashiko Closes: https://lore.kernel.org/all/sashiko-outbox-230439@kernel.org/ Fixes: bff8aa213dee ("KVM: arm64: Implement HW access flag management in stage-1 SW PTW") Reviewed-by: Yuan Yao Signed-off-by: Jia He --- arch/arm64/kvm/nested.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index ff78d2784db5..867bcdd69382 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -1718,6 +1718,7 @@ int kvm_handle_vncr_abort(struct kvm_vcpu *vcpu) case -EINVAL: case -ENOENT: case -EACCES: + case -EPERM: /* * Translation failed, inject the corresponding * exception back to EL2. -- 2.34.1