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 19B5ACD4F54 for ; Wed, 20 May 2026 06:49:58 +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=SYGoO+3vr+wCVS6zRiEdGY9MLJHWWaWiqDe/o0mDGzI=; b=ftKLZ2JQNhFa84ygAeOXo5n98f GSsPaNRqKzLyZG3VnnzIJgZX2MoT8vcqFsnf4Bdd9NglY0s/rnYj7e0PL/dguaTEN53ikL163rqQZ Un9W4P42zQxTmqYlyOR9Rxp4bIRFZ4NkAer54Pa8ymVWkhzzVU4BUp8JGT+c9eo6T4JgYDgHKGh2P 3qDt78NpE7FSH7WoC8Ts62G0tZUCpI6r7apzrRCwbc1GC4r9gI7DSfEZhGnugrF6jIVQvRnkLhRt5 upBzdaVx5ysrxduQ2jnR4ewbyX4fNqAqDbQgHOkRoU8OBj0DQptnnopJ1hVJK9eTet3CIe4L0pvEv Ac/LsB+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wPakd-00000003i7B-0BkN; Wed, 20 May 2026 06:49:55 +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 1wPakb-00000003i6a-1kVF for linux-arm-kernel@lists.infradead.org; Wed, 20 May 2026 06:49:54 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id BB1A6434D5; Wed, 20 May 2026 06:49:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B51E1F00894; Wed, 20 May 2026 06:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779259792; bh=SYGoO+3vr+wCVS6zRiEdGY9MLJHWWaWiqDe/o0mDGzI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=TzarIWMhkmz7SMufc86TM8YhhsuQ0r0YK/YsACMLXuPR8iZ/yobd3WtClK3szEgvT xpYLpdhGQAdpnizcPga1PxAdAzd1j8f4LQ17NOP+3eKonM6Zk2k/F3TNWSSg6xUeOA IRnwtto+REyB0zr5DKzwwZ00EQC7/qshn6m/ssweryX3pAWUk5boGpqwKWm3v7t582 LdeDABgNCWBwS8YkUuW6DdGhST4rAAZSvUQg1oyk8eXuHZLsMYW63rCEGhVIPnHtCG SvqngTpnLcE8AtmLbxK7pVQERuclLfW3h41hnFOt7+84NFcXxKfg+3GYxqHWTgouEU qNgc5CEbK3j8w== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-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 1wPakY-00000004Exw-0GXy; Wed, 20 May 2026 06:49:50 +0000 Date: Wed, 20 May 2026 07:52:58 +0100 Message-ID: <87mrxua7xx.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: <4v4zv3y5yxwkfnouqcjxhrwxvnpd7c4oodevrcgivxu2aeaiyg@2b3arv4mmv7n> References: <20260517174955.273004-1-michael.bommarito@gmail.com> <8633zpxh1v.wl-maz@kernel.org> <4v4zv3y5yxwkfnouqcjxhrwxvnpd7c4oodevrcgivxu2aeaiyg@2b3arv4mmv7n> 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-20260519_234953_504854_88BB9ADB X-CRM114-Status: GOOD ( 26.95 ) 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 Wed, 20 May 2026 07:04:26 +0100, Yao Yuan wrote: > > On Mon, May 18, 2026 at 09:23:08AM +0800, Marc Zyngier wrote: > > 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? > > So far No, may until one day it has more than 16 definition :-) This is 16 *bits*. That 2^16 possible MSIs *per device*. Please show me a device that exceeds this requirement. M. -- Jazz isn't dead. It just smells funny.