From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE5363E2AD8; Mon, 18 May 2026 08:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779092592; cv=none; b=dGR4VvZotWScDxg2fdezeX0K61WvS3knWUiwtbdTPqHKoYQE276raJL/Bw0aUj/0ehIeh9/KiuSe/expsVLxA4dqnN9PDE5nFBredH9UKbhcZbBIMZ6PbbspU05AfKl71xt//SdazIqDin81T3uptfnvLk35kwwrxY+jTDhUdo8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779092592; c=relaxed/simple; bh=uCF5CmaE3lUrpp7famdHrfOeL35ydPnxtwZzBI+wrJM=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=PaR0G5UtcHJF9HMXPpBVo36vOY4In4oq4fkhdn8MNZAZd6vMFA51qLALK2jir5iO6kGpwx+EOnzDLu7PoqtZg7AMH4JTIjDA7z9lCe5Lwv0itKQJSD6AjInmSKtVP+iWE44xRmMk5uVJGBmQiIkygq/Z/W6Kr6PzjWLBRlnc1TE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i4S+iSbT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i4S+iSbT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 774E3C2BCC6; Mon, 18 May 2026 08:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779092591; bh=uCF5CmaE3lUrpp7famdHrfOeL35ydPnxtwZzBI+wrJM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=i4S+iSbTguhWa8638BrXdyRk2TSkTPMpfZvgYOXhiXO32erYFjY8Jg13vCLWrXy3W 1AZLCm5w5JKEZiSyVxrGcOPLu7QdVTzotGdxVBvn7W+lvTw/Ihe+m7vQMRHpfTHEek LlIhvbS6A1e5pZ1XCeZ26oVwq9YsX1vYh0kf8x+qq3EjH0z/qK2qWbJsymAsl33yY7 Am1PAbgTI+YT3QEYueCcz0JNx/uMGQxPlRac13G08GCbrr8B6wYelMxi4iTGGxfmyt rz3S8qotiqrV2TEbKmpX5OJUt7xpUe20G53+bgUpsZP5tgq0H4Kbh+alUXjcmdCjCD WugC/fSOmksIQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wOtFl-00000003QB2-0Cwg; Mon, 18 May 2026 08:23:09 +0000 Date: Mon, 18 May 2026 09:23:08 +0100 Message-ID: <8633zpxh1v.wl-maz@kernel.org> From: Marc Zyngier To: Yao Yuan Cc: Michael Bommarito , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: vgic-its: reject restored DTE with out-of-range num_eventid_bits In-Reply-To: References: <20260517174955.273004-1-michael.bommarito@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: yaoyuan@linux.alibaba.com, michael.bommarito@gmail.com, oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 18 May 2026 07:05:13 +0100, Yao Yuan wrote: > > On Sun, May 17, 2026 at 01:49:55PM +0800, Michael Bommarito wrote: [...] > > diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c > > index 2ea9f1c7ebcd0..a5dcf9a6a2854 100644 > > --- a/arch/arm64/kvm/vgic/vgic-its.c > > +++ b/arch/arm64/kvm/vgic/vgic-its.c > > @@ -2307,6 +2307,15 @@ static int vgic_its_restore_dte(struct vgic_its *its, u32 id, > > /* dte entry is valid */ > > offset = (entry & KVM_ITS_DTE_NEXT_MASK) >> KVM_ITS_DTE_NEXT_SHIFT; > > > > + /* > > + * The MAPD command rejects this case; mirror the cap here so a > > + * restored DTE cannot install an out-of-range num_eventid_bits > > + * that vgic_its_restore_itt() would then convert into a > > + * sign-extended scan_its_table() length. > > + */ > > + if (num_eventid_bits > VITS_TYPER_IDBITS) > > + return -EINVAL; > > Hi, > > IIUC, the same issue is still there when VITS_TYPER_IDBITS > change to >=28, I know it's limited to 16 in GITS_TYPER's > definition. I mean the issue is still there w/o really be > fixed. Change how? This is a hard-coded limit that reflect a practical use of the ITS (and is already 32 times larger than what PCIe allows). Are you suggesting a possibility of making this userspace configurable? > > Change the scan_its_table() and other related code path to > avoid such date conversion issue is more reasonable > fixing to me, please also wait others' input yet. I don't think this is a reasonable course of action. scan_its_table() is generic (it doesn't know about any table in particular), and assumes that the scan parameters are validated upfront. Thanks, M. -- Without deviation from the norm, progress is not possible.