Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp323871lqh; Fri, 31 May 2024 02:27:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTmvmwrimeqtwad1SEMHMYrf8zRGdE9fN+WDwGLx6j0QWtoYSBzikSU0xPsZZK2vyXOurD8VFJlHLIgaeiY/Smhpx40ULgP3ozwVxDZA== X-Google-Smtp-Source: AGHT+IFM0kX+BPxDWf5ttpWnools9Su9dzjm2IxvlaNDcWdcTpp8QfL17MahFyD41AzHz0f0UplN X-Received: by 2002:a25:a528:0:b0:dfa:57f6:d629 with SMTP id 3f1490d57ef6-dfa73c34e6fmr1302802276.25.1717147633083; Fri, 31 May 2024 02:27:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717147633; cv=pass; d=google.com; s=arc-20160816; b=mA1WXLkoHAuSuBWbcvXJ5ssL2y8+SPGjb6tesI+eyNvZyNusRUHRABx6ov7l3oT57y eCmpm7JfIxUiKQOiY/y37UN3e/ECaxsqvgS0ZRQLX7xvHtvkQ22ir2tVA9dGtW0O87Jd 0HfFByIz5rVh8e/gmkMVTUIo7Dl6iq5KDTDUWVhlZsq59AbKp3uy1U3/5N6padQhxqWE r1I2UpM/jRlt8Qitn75Z2sZ2CXB3shFe6AhktiY9M6jB0yi0h/0MK0jt6MeAuuSWYjux RdzPrV07xqSJNHEadvWlqDMqgVYCHcHbBwgd33FuCj1yW1BsZ6e3QBjeFZxY5UGybr13 chOA== 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=HYW6Q/XCOanxhgitqWasUBVZ/j9aOHcpx3ECGmWmYSw=; fh=2lCcX8hF6Tgcdz9dAjEAjG4IFqoEWzHVVFj2WeVRPcU=; b=vT4TRgN3VS2FURLBzAA5oIk+uYm3YE77GobZg0ohI5UgVirODAdfF02pem/RJq5Qhs qB6CgSzMHVtkDpXht59tR1Jswvp6y3UsXo1XwsH1Zj++oseJuyblNlYwDsdgxxDEOnxd uiQoO6aEzXFFibFf6lwC1P8F2o8UQH+mfQ7QBvU9TlBt0yA/zAAOn57n7vj2/tZievbb rQkwxuEyIJXGD1UQ1r3O+AQ0CfMPtFZjvjODa6JB2O0ICXjRB4s7uDTQ11rlkLWMHej8 5hFOwhNuMGrIjjqpzjIiwmxnla/Lu/N9Uz8eUvTYQ9jTzVq9VYR2+D7LjosPc4eet+2x lRag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s15xrfFB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b423a5asi16414486d6.433.2024.05.31.02.27.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 02:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s15xrfFB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196579-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C9BE01C21D00 for ; Fri, 31 May 2024 09:27:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB18478C9A; Fri, 31 May 2024 09:27:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s15xrfFB" 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 12693770EE for ; Fri, 31 May 2024 09:27:07 +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=1717147627; cv=none; b=nGfCD91Ta91wHFXjfhCvRLcZpT9cNWyJPG7sWuUN+5r56yqamGXCGVaVPG/a2yG2RQ3aeUfOW8kDlUU4ZnG2jylEnOnnb1VKcrIkPxP2s7+2xziWv1LLLKhgeAYlpRvmm7TnFoW0/117RUr4/pPodV8h7aA2sk/e6h0Ua3qbXNs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717147627; c=relaxed/simple; bh=a7wmDqmUfEy4sWh4SogWxUyxjOiHWPHOFeUWeU5qm9I=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=TbTOBwxgXzsleI/DsLZUuC3iu0077qZrSeuKWjYzPD5TaC4xHhEFGLxGyd3X06k0K56wqKScGBeZay+uutyv3sPMpjqiHekaGCSgXXEDxufBMkVvqN7BBJGOz0+UPDBcNdOouJ7EcX+yPWmJrBYqK7sMjRPrKNRpT5w3JEk/WuE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s15xrfFB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1450C116B1; Fri, 31 May 2024 09:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717147626; bh=a7wmDqmUfEy4sWh4SogWxUyxjOiHWPHOFeUWeU5qm9I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=s15xrfFBXLLa2OztA12J9cnSuK2dOlgh+od2sYYyavwU33qQ78WmvBa0HEUaDWP91 4yuOGl4/jwg2hP44S7KlhweiIDfe0f8fD34F21730fL6gKBTZSU2b/FF4M77w0ZK6a 2HZBPZWgqptJKEzdK0XVksSPVvs6YBgWWUcbZEGjkzez1BGf3MKqaem5SuTO9l4/6y N2kr97V2NUfm1wlUPnXD/wvIdujAp0LVXrf4EyegofsVMA1dLBqNQ1FiM+p0/HizOl 2DK6CXaFF7n4Cpdlx/+6xlU3cJgQhmcTE+A3ZAv4VpdToWYLueaIWlg8jLIyniV5Cb XoYwT2nOWI0ug== 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 1sCyXQ-00H83j-Fj; Fri, 31 May 2024 10:27:04 +0100 Date: Fri, 31 May 2024 10:27:04 +0100 Message-ID: <86ttiel4bb.wl-maz@kernel.org> From: Marc Zyngier To: Hagar Hemdan Cc: Maximilian Heyne , Norbert Manthey , "Thomas\ Gleixner" , Eric Auger , , Subject: Re: [PATCH v2] irqchip/gic-v3-its: Fix potential race condition in its_vlpi_prop_update() In-Reply-To: <20240531074302.30563-1-hagarhem@amazon.com> References: <20240531074302.30563-1-hagarhem@amazon.com> 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: hagarhem@amazon.com, mheyne@amazon.de, nmanthey@amazon.de, tglx@linutronix.de, eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, 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 On Fri, 31 May 2024 08:43:02 +0100, Hagar Hemdan wrote: > > 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. So instead of peppering the locking all over the > place, we hoist the locking into its_irq_set_vcpu_affinity(). > > This bug was discovered and resolved using Coverity Static Analysis > Security Testing (SAST) by Synopsys, Inc. > > Fixes: 015ec0386ab6 ("irqchip/gic-v3-its: Add VLPI configuration handling") > Signed-off-by: Hagar Hemdan Given that you have lifted both my proposed patch and part of my reply as a commit message, you may at least credit me with a Suggested-by: tag. Not to mention that the blatant advertising doesn't really apply in this case. > --- > v2: moved the lock to its_irq_set_vcpu_affinity(). > Only compile-tested, no access to HW. Was the initial patch tested at all? M. -- Without deviation from the norm, progress is not possible.