Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1062143lqj; Mon, 3 Jun 2024 09:04:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkU+B9DJi2d7rGGCDxOxlM2wXP5bq//xUx0lQ0Ze5T+gQy86YuN0SnNl4oxgCO91573vKhJfjd1UdWqJHyHMjuc6GXstFL5bCnbf/KaQ== X-Google-Smtp-Source: AGHT+IEGc5cGZEogXQb77TCATs7qrAGDHXcOgDuNSB/XysKyX7rp+q51BP5cnZBOfUXy7hehrGtt X-Received: by 2002:a05:6a00:23c6:b0:702:2749:608e with SMTP id d2e1a72fcca58-70247666e59mr13272849b3a.0.1717430656882; Mon, 03 Jun 2024 09:04:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717430656; cv=pass; d=google.com; s=arc-20160816; b=yiQ30qERD+00pFWlMGVavhgPc0hY4cvsCJiSJZMOZ9XSZBsB4PGG+tf1qM2Zqqc0Z2 H7dvITTDzry3R8r8RKrH0AEPpnDQYq+yA3I8GOKMBmMgWvJ5CiR5DVitrAqEHFop2fos L4t3pj9woXK4+5HmMkP70UtFAdkVFj7qh1GjUix0wHCNrdYaRZvoV0MW1Hy9M121my3w 9ra2fN693Yffh3cj6snp78VX709DWZX8xV4xIfhNGwV/es65c3O8rihbqEWsu2mnFdZP 072hp7vGoOEB1keonLygj/5qZjQB2Gd5kO+4/rP0SVXNRH7fG8nJOSFUDrdd/0zNPEzE h6+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=IfmTf/aLvtzEJBm+VmwG8mCKV/Qul2Trf5pGzMsgwzY=; fh=JHmDlOmDovJ0o7bDLRs2CSBRwj1hNHDybLZDcqAVuZk=; b=WLE3acNtq7P69z1J1kuSxHlieecRw7s2j02ir6NUTEjY8pBbBWZSdK4DqrKOgBEXNh iudWRgvnIiB0q1cazx96Zwottan/OY6qAwEMBH24V4/pCQ6gFFYs6qNkrOojfbEXdVT3 kfstJLA7z8QBUnnajvc4dY5DZV9yV3qY0DKTSLEuk6GIdevcEU1gH8ndd4rkDpAec8Ns JPJ7w8ySUEE9FtwmzV1SqGjYvthwTMh+ELlzxnDuGQ6ar7QOztVwLRTUAp5J2f7u/XNn DaDcyvY3VUY7o3BW+qu6OL5zA7Y8x4fRDhuaD98huGpIhCedXQ8WS8CA/fbrCNZHei1F yB5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=inVrbcEP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199402-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199402-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540f9151si6604299a12.2.2024.06.03.09.04.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 09:04:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199402-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=inVrbcEP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199402-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199402-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B7A07B22B70 for ; Mon, 3 Jun 2024 16:01:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B811134409; Mon, 3 Jun 2024 16:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="inVrbcEP" 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 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.