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=HQNJGm8H9+5McEVRHk/ycVjxCnfyL/IJbRshMtRTR/YzuKhh1NdGhrCStc30Ke0KrLX9 xGq/VjLN9yYzeeGinPA88wg4LMrKKsafPG23RPVu3BhfxV6y/QmyJI50+gW2yPBse6bwa w6TOaKzJ8ZW4KtmeMh/3pDOcV5RlmXZ+4fK2mUKS5FoqfXDGk5ejhUeVhMJtktfu/F+DD PhFqgi/IKFWJ/oe2LbLjGA3EBQZF6fm6sQof9gH/nRAnp4aLiGoYRqwxOWFoboPP2bKDQ BYG7SEa9x/6dz5h1AB4+UW3XOWzo94bl1MOr51XBuC3bITlp80ZqDAvPEYiYjJIvdWg== 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=5aD+sYxb2F17R/CEpY9dAIkTdhuPaIUWXCr2VWS7x2L1wV/o5lVLlXuCWIgsk+fP/P2+ 7jsE/26R/qMz9tmXc6cXgFUYMiHHD599lsIpYZM3I3io7KQ2//5XYLSRPyhMXk9/Aho9g Sdo4/TKYRucfshiB2NZsiMAkvBLj8IUiK0W9KmDYESaJ9SjlGcB5X2F9RcFCKC+luvhBF zCcwciuhTosXQRPiLe25xKqlWjrZ0f1x5r3MJ7nRlKcNx9uquRF7aeyOgQk63DDn4oCAx SmCAwN2+brCopTOJVux7CqKEfvkPIF6fTlZJ8v7FfTf6rUm6Kpzw+qxvNkZeHdi/5Fw== 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 21084606A33E for ; Thu, 3 Dec 2026 10:58:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 21084606A33E 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: kvmarm@lists.linux.dev 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