From patchwork Fri Feb 2 11:40:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 19844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp420127dyc; Fri, 2 Feb 2024 05:18:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEcelp/lpZnMIGMvFML4+BFE4r5Fsva5ZlQWYrKmxS8dDrVGRkFcZm+ZuMTNJyAe/HWzpC X-Received: by 2002:a05:6a20:3d06:b0:19e:427f:9d52 with SMTP id y6-20020a056a203d0600b0019e427f9d52mr3355200pzi.14.1706879935593; Fri, 02 Feb 2024 05:18:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706879935; cv=pass; d=google.com; s=arc-20160816; b=Zaw9PyFFIvcrlmEb0TEoAyYPH/GdDBXkN6rx/2s/CkBfiDbIZ6ZJLZ4MiFKi/jdjkl Z/9kMQhFEvlMbnFFAy9G4yGxLrwy386IHyV6oD9QF/+EabrXW2HWaI8mhjRjBcQicniX VDAlqPz3+6bArYBSufCIzBTypKsb8M+sCuyhBkiHTs9nhV5fVTR0bcQ0wikLdBU31bs4 u/+zf+j2U1ZN4+jbpaxV7AXeCOrOQQUpE+cohsM8z/GnN7jB0kChXQ73TrFrPY0AxLMN 7HkaYtoWVvORjA9T2otjd9CqmNQTRkMFrStHxP9+T2PeNNuVvF7UDkuILqyNihVnqJ2k es3g== 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=jyxaPVKHjhX2whIbrisXuRHQ0P5uo/lYAp3tGX+jYmY=; b=H15Er9V6RzyBy1uyCTyEL5fWQRxKZLbu8bZoZo1AXRfK8w5GISk5ScCX/z7Hdd2WYn RTXT9ObkywUcpGvHNJtAUx7nJDPF7XeYLWslTV3QtsS4lHc0M9zMXxD11GsVrA7v93J3 zQl52YbQHse9r/FvGZhqYqSOXRcXgP/LIqNdTpM/KYCugANzI8SXMYBbm44S/PEEpYA1 q4FtlksxpWofkbvKpCNjqja5qTUxfdFLo6uzL7LLM70Kk+rQ87RpgJLOK02JUVLicfeF eKZ970LVwRuVShKFe9pCloBJt+BYjf67VWDN7FMDu3FbuqTpRndYOZ2wIZqalHo03rqS 17mg==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49773-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXonvu0RUR6db7eRnfai5h0y+9u+mO9B2wELdrGILXzGc75zdy8k2oEtD6PrMhnunLpyyVSaX+tTND6jmJpzeU4LHE/Qw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d186-20020a6336c3000000b005dbf22d8443si1617320pga.1.2024.02.02.05.18.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 05:18:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49773-ouuuleilei=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=EzAeTxxf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49773-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49773-ouuuleilei=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 C8CBD2920C1 for ; Fri, 2 Feb 2024 11:42:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99F2B13EFF9; Fri, 2 Feb 2024 11:40:20 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789793335629012882 X-GMAIL-MSGID: 1789793335629012882 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,