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 A294629406 for ; Tue, 14 Jan 2025 21:36:50 +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=1736890610; cv=none; b=K0IxUMyxHm4yPTwT3uYCgCte24abrv1NyHXHsT0gE/yZWYbwCqvLcMR+/xMIboav05x58pRa4vgQZRCNuB4VVOZZYexw/DlUeDm+7YHVQ5broK4JxKxbpNZ510fZmDPB1Iuuv/pEIOVb/pAN/lObsXXqtpqC/fcKr88U8GkajLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736890610; c=relaxed/simple; bh=khg8uktsYykUQX7JNA/3gsR9UMXC5UQ3BDCAKb62ws8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jTYbfqeQOcnaJ68pFX29k57tYQgSLnDKoyRkAqpr6a6qmmP7lOKly4DpSoZMdpdIFFN4jMBXVIc3LwPbe1fy6Ml6NK+VLsoTOuwHRXbxZatRzNyUWDFrE/pu2sJXxHVnMzRto6EUEKGSJUkxZB+8zkZuqWS4fvcrImHz3aYNgrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D6wZ/RpW; 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="D6wZ/RpW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD77FC4CEDD; Tue, 14 Jan 2025 21:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736890610; bh=khg8uktsYykUQX7JNA/3gsR9UMXC5UQ3BDCAKb62ws8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=D6wZ/RpWi8FcVhzV2yLyVhaEZ+zMxq7GvY6bWWHwdNuRcO7M6zHwxZRf6Y7TXwBD8 ppsQ0wYFIrrHEOdywkIsfBOP83OjqZVjSVIXq0CeI0Q62PwZpiFIaWbysmLioYNH2W 7zSreijxbqg8/So2gln5ZAYXp4ha2rVQsVk36qX3AqebvRqn0cgk87fbS9sgWS48Nx ABRFJV4+vMDNL4uD76rWJp7iBim8eSu10YkSQGOsfQ8n2jRNjPpmg26OxldNwKc0ID 6vjbdQePzr3DbCeZaKEPjSPLzm+qG/GTplj/Yg7qx2hoCcJWi2GDRkvH/ioVQxlz+v taAd400vWKaWw== Date: Tue, 14 Jan 2025 13:36:48 -0800 From: Jakub Kicinski To: Eric Dumazet Cc: "David S . Miller" , Paolo Abeni , netdev@vger.kernel.org, Simon Horman , David Ahern , eric.dumazet@gmail.com Subject: Re: [PATCH net-next] inet: ipmr: fix data-races Message-ID: <20250114133648.36702172@kernel.org> In-Reply-To: <20250113171509.3491883-1-edumazet@google.com> References: <20250113171509.3491883-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 13 Jan 2025 17:15:09 +0000 Eric Dumazet wrote: > Following fields of 'struct mr_mfc' can be updated > concurrently (no lock protection) from ip_mr_forward() > and ip6_mr_forward() >=20 > - bytes > - pkt > - wrong_if > - lastuse >=20 > They also can be read from other functions. >=20 > Convert bytes, pkt and wrong_if to atomic_long_t, > and use READ_ONCE()/WRITE_ONCE() for lastuse. Drivers poke into this: drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c:1006:43: error: invalid o= perands to binary !=3D (have =E2=80=98atomic_long_t=E2=80=99 {aka =E2=80=98= atomic64_t=E2=80=99} and =E2=80=98u64=E2=80=99 {aka =E2=80=98long long unsi= gned int=E2=80=99}) + 1006 | if (mr_route->mfc->mfc_un.res.pkt !=3D packets) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ + | | + | atomic_long_t {aka atomic64_t} --=20 pw-bot: cr