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 6D59526AD0; Mon, 3 Jun 2024 16:01:13 +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=1717430473; cv=none; b=bzSTfnFngEAhkUecHZ+x1YEk0ZWbGrEla7j/U+ppaBO/wdQHFSWiabdCuCuSCTAKfRiaotzXc8+orYy2sptfMyykIUC2JR6n/ES79mVbrh2ZIH1bAJYQh+NBBtnhKgjtumX/7NdUMu00eR+g7RPZlRgutQsj+NIX4CcJtt2OQJo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717430473; c=relaxed/simple; bh=Iv1Uc6RhMV8UTtYf+csBgZAea6pO/MLrB9bZpKUWHsw=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=PRpj8QVif61eaXBrEWhYtZ/2mHwqASkiS50p2KJGumJIJR53NGJh4S1xBINKF6UNwqtHth175EuCFeYVo6uHN7gMz18geW8QVvJkIWLnUiJeiB0rHtKQ5M86d8B5zreweQfJ4zzc/hT68fpqgw6/eMG5kYNGi9oEddvrjsOaLIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=inVrbcEP; 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="inVrbcEP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E17E8C2BD10; Mon, 3 Jun 2024 16:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717430472; bh=Iv1Uc6RhMV8UTtYf+csBgZAea6pO/MLrB9bZpKUWHsw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=inVrbcEPSdpAHVrE7BOlBkaNG+nL0oLLR9ZPw9KHBGFHot8eCM6ep9LnM9H7WNkPM BT6Awd0gVdP2AG5W8PTk9E7B6VJKWIq0o0f7Ve/qNRGBvo8pt5xhV7d8tm+AAoaEqX 447D0DasWT/TaXDLSowPzBcnN5i16DuSvy/OYrR1fReSiSp9sL1gJv1QuV5PxHnK9r VObMyOEdHQrTj09LxO2ZkzaIK0c2KAthaaOTkCCSVmeEtoof3hn0alU29hbzZSJ6qA N7/3QZCxQ4NcAYqjlZnoEA5/AvpDAovHNbSh9fm8BIM2ydVER7NbaKtoyYLQzFndp+ BmsXHIRLsf0UA== 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.95) (envelope-from ) id 1sEA7S-000Hvn-Tk; Mon, 03 Jun 2024 17:01:11 +0100 Date: Mon, 03 Jun 2024 17:01:10 +0100 Message-ID: <86h6eakoc9.wl-maz@kernel.org> From: Marc Zyngier To: linux-kernel@vger.kernel.org Cc: linux-tip-commits@vger.kernel.org, Hagar Hemdan , Thomas Gleixner , stable@vger.kernel.org, x86@kernel.org Subject: Re: [tip: irq/urgent] irqchip/gic-v3-its: Fix potential race condition in its_vlpi_prop_update() In-Reply-To: <171741750653.10875.4371546608500601999.tip-bot2@tip-bot2> References: <20240531162144.28650-1-hagarhem@amazon.com> <171741750653.10875.4371546608500601999.tip-bot2@tip-bot2> 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/29.2 (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: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, hagarhem@amazon.com, tglx@linutronix.de, stable@vger.kernel.org, x86@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, 03 Jun 2024 13:25:06 +0100, "tip-bot2 for Hagar Hemdan" wrote: > > The following commit has been merged into the irq/urgent branch of tip: > > Commit-ID: 8dd4302d37bb2fe842acb3be688d393254b4f126 > Gitweb: https://git.kernel.org/tip/8dd4302d37bb2fe842acb3be688d393254b4f126 > Author: Hagar Hemdan > AuthorDate: Fri, 31 May 2024 16:21:44 > Committer: Thomas Gleixner > CommitterDate: Mon, 03 Jun 2024 14:19:42 +02:00 > > irqchip/gic-v3-its: Fix potential race condition in its_vlpi_prop_update() > > its_vlpi_prop_update() calls lpi_write_config() which obtains the > mapping information for a VLPI without lock held. So it could race > with its_vlpi_unmap(). > > Since all calls from its_irq_set_vcpu_affinity() require the same > lock to be held, hoist the locking there instead of sprinkling the > locking all over the place. > > This bug was discovered using Coverity Static Analysis Security Testing > (SAST) by Synopsys, Inc. > > [ tglx: Use guard() instead of goto ] Good call. Except that... > > Fixes: 015ec0386ab6 ("irqchip/gic-v3-its: Add VLPI configuration handling") > Suggested-by: Marc Zyngier > Signed-off-by: Hagar Hemdan > Signed-off-by: Thomas Gleixner > Cc: stable@vger.kernel.org > Reviewed-by: Marc Zyngier > Link: https://lore.kernel.org/r/20240531162144.28650-1-hagarhem@amazon.com > --- > drivers/irqchip/irq-gic-v3-its.c | 44 ++++++++----------------------- > 1 file changed, 12 insertions(+), 32 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index 40ebf17..c696ac9 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c [...] > @@ -1992,6 +1970,8 @@ static int its_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu_info) > if (!is_v4(its_dev->its)) > return -EINVAL; > > + guard(raw_spinlock_irq, &its_dev->event_map.vlpi_lock); > + I don't think this compiles as is, due to the funky syntax required. Thanks, M. -- Without deviation from the norm, progress is not possible.