Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2563162lqp; Mon, 25 Mar 2024 02:42:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpD2XYLSMujHvkHGhrynQnqBZGG7TYbjDJU97rpBor4ZFT8Jx+esDvMUpl60lNFwaJLhISkAWIyWOvGf8A9BKlDJj+rdvzcCRXYqPlfg== X-Google-Smtp-Source: AGHT+IHB1sAINiH9RVJx4xALyC7zP+omytqGWonN8zvdXJv7K2SOfdJe3Bbiea6z4P10TGMpBK/j X-Received: by 2002:a05:6a20:6d96:b0:1a3:a76b:337c with SMTP id gl22-20020a056a206d9600b001a3a76b337cmr4377844pzb.16.1711359778483; Mon, 25 Mar 2024 02:42:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711359778; cv=pass; d=google.com; s=arc-20160816; b=LKoo7bXfzVOouNPcjMfFn7iFrOI4oBp1FsPZz9qVoSmTnlpQnyZP2EhXrA1/4ZMC7H 2UOeIkkZQ1+Qobfnch3DyrEPUjBdwfgK3KJNssrw6rb7h1qv36cBFB6qQo5/gJhhkDYB CJYB15dx8HOeCix5Om/pTtv0U2jC5A057S/NXHFN2DPPj+NNQ2oI8LeC1e+nqx/ec3u/ U149TH5LOYXj82YGaQ/M+W7KmnjUI/QzynmTMdOVe3CT3hXT8c+KjjMTxIOSODIgkT7W XaWdo9fWXIN8EBvDKzWdm19wMRd62hhy94wjkWJnTXiAuUV3LSPb+QBMW+zCF1Q2PEIW 8VeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=FPFLY0syoBrYePo5FndDsB6d1hU/HD+KjKSMnUwpylQ=; fh=ZAlhzfbRz/4TWo8XGVrYtAKpOTV1f0c5WTdsjTIAmlg=; b=tbRq9J0nf9G9nWqsTPuJUItU3F7PK9P4l7xl9yJ9CPvqHjpNFAKojQseZnuWI13io/ jT6oc8W6RWRHXTJmzlPOh8mQxIs9fYu/s0IyYYelU911MWnfoVTkNTxsrqMNakaVHoAG tniITRmwrOtQGmS+wwz2Q6P6y+DTtTZjT7TEaQF2QHKTBoM1Achdoz88y0NsNhT72NKN vt5F4N2HI+0PC2SJg7bTjZCuipwHaFwlU2VtcuoDhD4aLsPG3yTBo/cmt+t0CqLio5Wu h1Bomu3x4NZFKYhsYm4tjlavwA48hkt/U3N85SXeoz+UxUJ6RFmoLUxDBIgj7S4nP3Bd ztRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iEsO+LQe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k1-20020a628401000000b006e724b23a4asi4854332pfd.369.2024.03.25.02.42.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:42:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iEsO+LQe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115861-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7832E2A3056 for ; Mon, 25 Mar 2024 09:36:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B410158A3F; Mon, 25 Mar 2024 03:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iEsO+LQe" 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 CE330145343; Sun, 24 Mar 2024 23:13:51 +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=1711322031; cv=none; b=bFaUuPKHNvRJhRi+pxQozuBHcO6UL5jQib1jpDaeaWrXDHEeF7O6DAI5vUurFEgO24HcWgyB6vIOZ+0Py46bFop4ddHTSdofz+64H6zI1iKRYCryAIMurQT1EpYz6dmj/ALZifd21e8UTeEBxg4V1yNZVlBQBwLvHuQ4/lTTE9I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322031; c=relaxed/simple; bh=ixIHT+JxOs9u7DVRarGZieExS4raCUeJ/OKOiBYn+fs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l0m69TynS/91fK7dsBZ1GaJguKrYqJ/B3aAVelQMheyLWG8BZfTttBYhIkd3bGljm/RK45eyKIbc7yUZ2BYpouhHnzrav6m+q2Cmo2athjt/0XctqO82FBD77SBJM03YHOB1OgxFc46CZeTcvQQVbdzaHbEV8DSZw8CMY4vVw+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iEsO+LQe; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 161B2C433C7; Sun, 24 Mar 2024 23:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322031; bh=ixIHT+JxOs9u7DVRarGZieExS4raCUeJ/OKOiBYn+fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEsO+LQeAbnQ4ACiRz6aO72KqVEWQJP9bB0NYKJxG+uDrh4YkQJiwdWIyF8ZZSbTr fvtBXNusX3lADX2D+7Xb2g5FgFie0JmQkElFZWZmyllAAAKu2y2XZV0sSXs4IFhcbg hEZjH/CwLBqaWxkXvQ8CFS3FYSWeLKeJajL0T/DrbZUJIq8D6YRS6mWaZT2wMYgHiN RQOcvazujIrjJoiPo/pDeHDLnFCstJYHMacUujcOc60jOkyeEyfCE1rzbdQ3fvHkVs qWxJQs68THd6bDoztF7rdd9CADXqkYGnRtyGFJDbAbZcNgjyOWPHLVrzFt5yg0qwf/ 8HurDTUskYk7A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kuniyuki Iwashima , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 103/451] af_unix: Annotate data-race of gc_in_progress in wait_for_unix_gc(). Date: Sun, 24 Mar 2024 19:06:19 -0400 Message-ID: <20240324231207.1351418-104-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Kuniyuki Iwashima [ Upstream commit 31e03207119a535d0b0e3b3a7f91983aeb2cb14d ] gc_in_progress is changed under spin_lock(&unix_gc_lock), but wait_for_unix_gc() reads it locklessly. Let's use READ_ONCE(). Fixes: 5f23b734963e ("net: Fix soft lockups/OOM issues w/ unix garbage collector") Signed-off-by: Kuniyuki Iwashima Link: https://lore.kernel.org/r/20240123170856.41348-2-kuniyu@amazon.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/unix/garbage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/unix/garbage.c b/net/unix/garbage.c index ab2c83d58b62a..9bfffe2a7f020 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -198,7 +198,7 @@ void wait_for_unix_gc(void) if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && !READ_ONCE(gc_in_progress)) unix_gc(); - wait_event(unix_gc_wait, gc_in_progress == false); + wait_event(unix_gc_wait, !READ_ONCE(gc_in_progress)); } /* The external entry point: unix_gc() */ -- 2.43.0