From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E425BCD4F3C for ; Mon, 18 May 2026 08:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Do77o/xByNZiSPLPmLii/SotJlMs+JtcPBjeWz64hQA=; b=HvTbJyKIu8X1ivfXazR3WETKqc QuCHfY53tKtl8VhlZ58NAdV2cSyQ3SjsB0F0XxQCtRdkGzlEDXh9nZTd9LnAdlojEYFqgis9nHqD8 Fke+lfivOxu95sxPPGSVOtYlPhejWXWP8eQJpCFkm6wskrJHokYD51/3EWll7qkfp7wqNGlrCZahp ouZAdevPU3TiuKtOkHXXbmChcmmxHgAMpY0w9AR/xutQhluPlKjlsz61OxTTK3jsba72cvkPIY0Ws tQ3t7snaMHyOjhg7iBZ8veD3ka90oOrAHTB5Eu5Sjxp9vozmzSIv9RWKjzhSRldGFdcGP8h5i7eOj Uynw9Yvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wOtFr-0000000ElQ3-19u6; Mon, 18 May 2026 08:23:15 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wOtFo-0000000ElOU-1r2F for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2026 08:23:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 9EDD2402A9; Mon, 18 May 2026 08:23:11 +0000 (UTC) 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260518_012312_521409_2214CD11 X-CRM114-Status: GOOD ( 24.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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.