Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp770876rdb; Fri, 2 Feb 2024 03:42:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuTEOLn5mdcpJ7qOiPXiz43paMNVZqCTCt04fb+Kp73qQ5FxbiQFHrX4MBw6sicJMeU9PB X-Received: by 2002:a05:6214:310e:b0:68c:7bfc:a8e2 with SMTP id ks14-20020a056214310e00b0068c7bfca8e2mr2927956qvb.20.1706874149847; Fri, 02 Feb 2024 03:42:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706874149; cv=pass; d=google.com; s=arc-20160816; b=CWxYqX+quLAdAQNtpDTfR91KISdgkRZYva1WYuSoMGS5jUx4kgKB68iqfrsfu4WImv W471ejPmiU8rC2wYtwHR8BivLxwriaGpzvP606BpTCIOHLuR3NdNvakz9wb2aI+IrCOk wdXvn1fXVpT3ZVaiJ7OAnt+JUtQtPEclHwxxHKgIsrgQLcZo6i6FR2zcT8vPK8OwNmiE pg6gsiKIBH5kYLJPycDnlREiJLq/wpph96rnskI+VGXByXxV4JVVREnmu52LcjfXaHvo aKH4DRx6iyWEI1g7HuAqD6vEPpn+J81r4i3r/F6DvrVGKyjdybzi3WaOIdsYL8zje+Dz wa7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=bZVFnUIA8qibCLG+c91ic4UHWgOkzkCi+BHCg6w4j8g=; fh=MGTys+8YgmjHjy9/sDLumsrMGO6SW7UUM/TLuMsd/BM=; b=g0w/ZZfo23NKQ1Lkd9f7Gua/nJjvT+XbqmSymxp6cFJdkygmkfxkf8ROoEB/UqjZmc sIiseACumdtojyO3UDHTdfUr2mrQ8KrHIVKx9p8GIs6c91JqL+NKCyxhllx/uRlrUYd8 0akegYpPIxR4B6b/bWY3BfHXAEzlora/8AtHTGIP1hyKL4kcQAaWuu63vtUsUJquPAvY XAvuB9T978AhBTj9Bbaj1yD98yVLVkkiMsERrEtws1+Iu54YjB4LPKpXgWRC32BPmzga 31m1HZKFGBn07VnpqlNqBg5jY3rKzBoALGVUMudJO8pJhvDCNoTWSqmp/WV6ZG5TS6vT Bxfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EzAeTxxf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCW2e1go/WZR6zjWYNqqWUOJ+EijmJh4YL76/XznsRHsRJ3TvYHyNZEv9MQ1qJXVQOHBueWLTL85+355+4aajrTMk3b5WL4npAL93MFJFw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u14-20020a0cf88e000000b0068c82cb6ecdsi1747158qvn.233.2024.02.02.03.42.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 03:42:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EzAeTxxf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49773-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 6D68B1C216B7 for ; Fri, 2 Feb 2024 11:42:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C753A13EFE4; Fri, 2 Feb 2024 11:40:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EzAeTxxf" 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 EC0D41353E6; Fri, 2 Feb 2024 11:40:17 +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=1706874018; cv=none; b=L/a6/4ex9PcwXWmA93yhdkpneF/pHxWcz8Nw3jsn8pI1j4Dz90c0Drb1MpCgYqG4WMfUG1yYvF0Xh9Vfd1nHDW+jNl+K5HK8KOqjWU2D5kvjrX9bUY7fd5TNR/ijdMm0Rpz0qDw66s3fed1pLcnuJKiQTYcPxpSXRBA+NxRVr6w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706874018; c=relaxed/simple; bh=pmXNxJih0SLNrS6yznEg0TwMHpWWCdklmhtMMEiE/70=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=tpb6UwDG/5KBJDHK3grfG91DzkiWBEu0tr8erKOXOLc9pUddoZkSQ3TVq1PBwNsVv094Hc0W4+aa4+D+1zrzzC/GmbqiIagaFaasVDr8hplaXsLtWln+FXIL9Cn3hL/QRQrqUJRnR7pLg1NOwYCEOl9QCOy7VP7ZRHv/keeayes= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EzAeTxxf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D26AC433C7; Fri, 2 Feb 2024 11:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706874017; bh=pmXNxJih0SLNrS6yznEg0TwMHpWWCdklmhtMMEiE/70=; h=From:Subject:Date:To:Cc:From; b=EzAeTxxfbwnmZ5ABAlgmUUZC87P7Vmrh4XiRlDuffR968ew01pt+gwyAoyWTncIU2 GnU99K0wCA4v7tTNMR3RAnF5YyNL0njlVQx2GnamWv6bvyShxcWE74NIdaIwqgxudh bfm2aEmPcQrKpeJKIacrgEbcmlBMSyUHfRpTpsWuEHoofNhS3hZaRQETIdgxSPC7S2 lsJZIoDpvgE0sX/Lsn6u79LhWYz4Jidzbditge2K1vxaEGgLp3PeSG162O8oJ5M1PJ 1Ax8oFhGLz+AhJD08aVT+offXiqVZ587AwVPwDCl7mjv3WUgzEIztKuQ++xzPTWMRt n3C8jdb3DqOiA== From: "Matthieu Baerts (NGI0)" Subject: [PATCH net-next 0/5] mptcp: annotate lockless access Date: Fri, 02 Feb 2024 12:40:06 +0100 Message-Id: <20240202-upstream-net-next-20240202-mptcp-annotate-lockless-access-v1-0-031d6680afdc@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAJbUvGUC/z2NwQrCMBBEf6Xs2YVYDKK/Ih6WzbYG2yRkVymU/ rupoIeZ4TEws4JKjaJw7Vao8o4ac2pwPHTAD0qjYAyNoXf9yTXDV1GrQjMmsabF8F/NxbggpZS NTHDK/JxEFYl5j+HMwV28D+QZ2n6pMsTl+32D3xrct+0DPt7CLZUAAAA= To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1729; i=matttbe@kernel.org; h=from:subject:message-id; bh=pmXNxJih0SLNrS6yznEg0TwMHpWWCdklmhtMMEiE/70=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlvNSeZXfgyaBrW3yctwOh+35j3mF6YJ4r0oL7H PBmlFPoFkOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZbzUngAKCRD2t4JPQmmg c0MnEAC6AM4hqiBA6uPXs/5xZo1rjIe9ZfGq2zXplEhmjNr6h7BaRVr/UF/PbaXtbegsIdHaP7P gqUlHlt3OoFVUHwOCQhfOWVN9DGHrpRl7IBbI5QgOhExnQutKOlKstHuHmV/C/Q3sFHwklQnCZ9 MJP1FI68TacA88KKBJyMeHxxWgFHhfEv2OUhOgP6T/tFBDF9393f6eDpZr41vZlluK47GC1I389 0pMr+Utab9GUPDwi/hOfjj5ohdU94wkDNWVPhJCtB9qA10NpvGn7fbSalTmclYjlzVyORXFzfq+ a9aBW1YWtKwwHg1EB41r80fnDQq4bS3du3HwC9InPLEmBzZRLqmkYiPjBQFxWCuUWDKV+0d33EJ hJ1Ur/nopGt2/z4LYXfb+SSUfp04N2PTQbF6PEGOPNWhbszE/4/swfdn3w0JflKz7/Jok2OV+tf I3+bj3h2xn8GtSABjVll1TTzGDqckjVFE68+6QU+M0UAkIF3KlO+NOj9tNmGthTeeBBJZtpZdWg 5m8OsqUu19OfM+G8NCiWco7TNUTqyTix3srvs+8RuIaY12ygMNuEPciWCWCDPOfS/3loe4dCRAq dbhrlxhcoWRPLvZ5EEXORfysvoP5UM3bQkFEnBxne/fwOwNUKE0SRu1/dMuvnWjZTftcsysemzg sl152w8rYtOSKPg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 This is a series of 5 patches from Paolo to annotate lockless access. The MPTCP locking schema is already quite complex. We need to clarify it and make the lockless access already there consistent, or later changes will be even harder to follow and understand. This series goes through all the msk fields accessed in the RX and TX path and makes the lockless annotation consistent with the in-use locking schema. As a bonus, this should fix data races eventually found by fuzzers -- even if we haven't seen many such reports so far. Patch 1/5 hints we could remove "local_key" and "remote_key" from the subflow context, and always use the ones from the msk socket, possibly reducing the context memory usage. That change is left over as a possible follow-up. Signed-off-by: Matthieu Baerts (NGI0) --- Paolo Abeni (5): mptcp: annotate access for msk keys mptcp: annotate lockless access for the tx path mptcp: annotate lockless access for RX path fields mptcp: annotate lockless access for token mptcp: annotate lockless accesses around read-mostly fields net/mptcp/options.c | 20 +++++++++---------- net/mptcp/pm.c | 2 +- net/mptcp/pm_netlink.c | 10 +++++----- net/mptcp/protocol.c | 52 ++++++++++++++++++++++++++------------------------ net/mptcp/protocol.h | 8 +++++--- net/mptcp/sockopt.c | 2 +- net/mptcp/subflow.c | 10 ++++++---- 7 files changed, 55 insertions(+), 49 deletions(-) --- base-commit: 747056a9a954d694dac91d1da6cfff5e6f0e3fc6 change-id: 20240202-upstream-net-next-20240202-mptcp-annotate-lockless-access-f7cd0955da5c Best regards, -- Matthieu Baerts (NGI0)