From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 028E9282F1E; Tue, 18 Aug 2026 16:12:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787069552; cv=none; b=f1jXf2rTW4Ny0liEj8XjlGbhfIgNIVCFXw0GbpOm+0ZjElc8hihM8peBAayKiIu4DyBqmUJq7jjpCWMo587BAm4qV8kITquIDWgedOVyWvs6yFDUEZZbBHUFnf40uW7DmqSDgp4Vqr/PY2xgx+Dc/y4JI71jiIPUcdOQPwgfx60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787069552; c=relaxed/simple; bh=P2PWozcu2sCCQVd2ueH+8VGwvPlyXhpt8AG4GK9IJ0k=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=X9ZdQhMz1fs4KcOR6q0vKM6mnKpR45hmeUDmNpeqZH1s/s85F3do720MzhDQls/7ZLvpmjqGx/91qBdOBHhJBBlcZHhtDHTaXWdWY0zspfQaExxZdKX0G1rq9JdRMaVD/GQSSiFsA0b7bFNuEor8Q9VPjFgxqhwinuW8oCeNugw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cWp5hQiT; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cWp5hQiT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E3351F000E9; Tue, 18 Aug 2026 16:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787069550; bh=GrXrMuiesxftt1DXnu2ZTlsi1uFiEr3n3z3WjCq+UDE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=cWp5hQiTGuFL5hgSDgtWZ1B9mwrZAEKufqsB8QuR6AmR/mADMPpxHIj1V6cf7MPfO 3oDPePgbwL09wODEyb03v5ANLZM+pLjVXt2ByTXtFWlOB9TOSylxuFT8r/u3CbFbgQ 2OGlMVgp7rJ1uwWvFFpYvfL/H60v6BmhMzaqPL9DwAbGVSjRymdcengpx1FtqtjzKW I32q2U8uEm6DMXUYIXzoAvJDIgpmoFqyfe+busL3D/WmdniHNseNi6JEU/Ys3+UlGk kFoAX28oOsmVuINgmepF90f+CwdT9bl255neRrL/S9tGJ26GWE6Uusao2+XWfzMJk0 bVy/31Ijpkc3w== 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 1wwMQO-0000000GhD3-2p0W; Tue, 18 Aug 2026 16:12:28 +0000 Date: Tue, 18 Aug 2026 17:12:28 +0100 Message-ID: <86a4qj5rwz.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: sashiko-reviews@lists.linux.dev, kvmarm@lists.linux.dev, Oliver Upton Subject: Re: [PATCH v2 2/4] KVM: arm64: vgic: Don't leak the SPI array when init is retried In-Reply-To: References: <20260807104102.2410744-1-fuad.tabba@linux.dev> <20260807104102.2410744-3-fuad.tabba@linux.dev> <20260807105558.73D701F000E9@smtp.kernel.org> <87fr0pq5uu.wl-maz@kernel.org> 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: kvmarm@lists.linux.dev 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: fuad.tabba@linux.dev, sashiko-reviews@lists.linux.dev, kvmarm@lists.linux.dev, oupton@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 Tue, 18 Aug 2026 14:22:09 +0100, Fuad Tabba wrote: > > Hi again Marc, > > On Mon, 17 Aug 2026 at 19:40, Fuad Tabba wrote: > ... > > > I really don't want to have to think about the intermediate state. > > > > Agreed. I'll drop the idempotent version I sketched and do teardown > > and reinit instead. > > Here are my thoughts. Three patches, all fixes. > > vgic_init() will undo what it created when it fails, so > KVM_DEV_ARM_VGIC_CTRL_INIT is all or nothing and a retry starts from > scratch. Same thing you asked Karl for on the redistributor rollback > [1]. > > That drops the count check I sketched. vgic_v4_init()'s early return > stays, since vgic_its_create() still calls it for an ITS created after > init. > > irq-gic-v4.c goes first, as two patches. It removes the domains and > frees the fwnodes without clearing the pointers, at four sites, and > the teardown above makes that reachable on a path where it was not. > The second is a leak in the same error path: when > its_alloc_vcpu_sgis() fails partway, the SGI domains already allocated > below it are never unwound. > > What do you think? Hard to picture when described like this. Please post the patches! Thanks, M. -- Without deviation from the norm, progress is not possible.