public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org,
	Hagar Hemdan <hagarhem@amazon.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	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()
Date: Mon, 03 Jun 2024 17:01:10 +0100	[thread overview]
Message-ID: <86h6eakoc9.wl-maz@kernel.org> (raw)
In-Reply-To: <171741750653.10875.4371546608500601999.tip-bot2@tip-bot2>

On Mon, 03 Jun 2024 13:25:06 +0100,
"tip-bot2 for Hagar Hemdan" <tip-bot2@linutronix.de> 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 <hagarhem@amazon.com>
> AuthorDate:    Fri, 31 May 2024 16:21:44 
> Committer:     Thomas Gleixner <tglx@linutronix.de>
> 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 <maz@kernel.org>
> Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: stable@vger.kernel.org
> Reviewed-by: Marc Zyngier <maz@kernel.org>
> 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.

  parent reply	other threads:[~2024-06-03 16:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 16:21 [PATCH v4] irqchip/gic-v3-its: Fix potential race condition in its_vlpi_prop_update() Hagar Hemdan
2024-05-31 17:39 ` Marc Zyngier
2024-06-03 12:25 ` [tip: irq/urgent] " tip-bot2 for Hagar Hemdan
2024-06-03 14:40   ` Markus Elfring
2024-06-03 16:01   ` Marc Zyngier [this message]
2024-06-03 16:20     ` Thomas Gleixner
2024-06-03 16:26 ` tip-bot2 for Hagar Hemdan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86h6eakoc9.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=hagarhem@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox