From patchwork Fri Feb 23 16:14:11 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: 205517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp701624dyb; Fri, 23 Feb 2024 08:40:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWCtrutmFVeSBo9gWUCkJWibY+UT54BE23liBFZNKVC5SfBbvwJP9/IhN/sTPn/fmaXRzdFrzeNAAyhcfra5lsD5TY2Gw== X-Google-Smtp-Source: AGHT+IGbms+mZUiMDRCGsdOjj4dkDqQarELaYQOhOLzz8AjKO5ROPfpen56Bgl7RcXZ0ze/0RKK5 X-Received: by 2002:a05:6a20:93a1:b0:19f:c0d3:43d8 with SMTP id x33-20020a056a2093a100b0019fc0d343d8mr510205pzh.11.1708706416526; Fri, 23 Feb 2024 08:40:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708706416; cv=pass; d=google.com; s=arc-20160816; b=EPNIXHvsMoowOnigY5CZfCHf8l0JUXYKKLD261GbJgmpt0W5yZQWNzHTLw3m817RXs bpUm6LuYwsTweYty/wm66vnK/OOTtQLx28dB3My+//Dn4m3EoPqTzKO7xuqFDRnoC3xp Ab6si0yWVEZ6RZ3tgPS6hKNuscH6m8g2sUxAncdUnqJqLItBntHI84LDRZ6JiMpqsEpr xP3PFvxJgpD1QI9sFXCoZaeyfe7zy9AWFkBnITmvoynOVBPaJcoazorsTQS4nnwoee77 3x+Oxw5xqlLf2r4haQzRy39eO5E89oRhdaOf+QdPYGh0nE7UwBjQFpte0OQ7GHYWbAsO CUIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=EeDMkuGzm55jfLMI9oe65Mjnty4+267Z9PnWkpxyawg=; fh=tHeEkhyqHGk1LGK1GVLG9H+11EfdbPltOPR7aCZnwg0=; b=uHj5SNSVQ3mgH6yZXwhBU4VA8sE5UW7lmUueLf4/lcZH37GVrVOb7ud6nFDAJaLbpn w0xgpP4USJkrrxHHTwA7VlNYR4uH0oxLP9Gl5h1T6mMxpqvH5CQz5Xc211Vgs01opZ2H Tl3VKAsSuVjTIfAQVTIDpvommddzxVTq8egYUJvi1RZ12PcXI3FNIowQjKw+uIwoYERH rajuEAMkdHXg8x5s0upJJZnktBLBHvJxv9WzUzgOFl3FuJepWdh4CnCO/u47fRq8LVR+ sLnDXDmk3t08VZ/Di0gUiQrQBaAIinidHKWylBrvU+8aZm3XYW0IpQ7FgjTjzGk7xchf rg6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lpKeJBT6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78689-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78689-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e1-20020a656881000000b005dc833ef4e5si12389793pgt.64.2024.02.23.08.40.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78689-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lpKeJBT6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78689-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78689-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D58D2B29259 for ; Fri, 23 Feb 2024 16:15:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 466BB126F3B; Fri, 23 Feb 2024 16:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lpKeJBT6" 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 B1FF18526D; Fri, 23 Feb 2024 16:14:43 +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=1708704883; cv=none; b=SoWQ12fW1JvW/KWYLtfN1xXVTFFJ8QUXs3gLUEQHfbsjrQXgj/AUhavcIOj0dOlR+Gz7A9vAehvBjHT+56P1EIeycKAbkyJ4gPiu/VDdx6nio7FXy0ALJ5A/057wqxfoHmSEv9yZyZiCw/VnalTyg9luNhGg/Qb3zRLbx954h+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704883; c=relaxed/simple; bh=qISUZKplFPWYmLkdmI1gLlKsQvehUGqkZjUJuQ2PWWc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qmuZECMDvROUniagG/prmT6jdeqlFsGDVgWLLo6XLGsBhtCTJKQsr7T0GlyvzSGnVlgZUQeAjcLzA1i4CNVaDdCJ+6LD5uxm8eMJzrFuW4pgFjBBS1DiQoG8NlrujJ65g45md+5GXPtsaFXm6YpNLtBpDZYLnPeKdFOf9WE4vl0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lpKeJBT6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18BC4C43390; Fri, 23 Feb 2024 16:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704882; bh=qISUZKplFPWYmLkdmI1gLlKsQvehUGqkZjUJuQ2PWWc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lpKeJBT6k+vV5p9rMNOt9vObKqfXrazOQ431ipCowoLrfa7CVukqhilijvPWQG2xi jsg829/alLeqOm+3DN512ZTZKc5Krw8z3M6oZi2FooZrsYI96xOcqMaVwP9bAz3q0E XK/7MD5maKStTI6NYdA3QNuYWubUzrq8M0ghuLs7ah10bncZ2jSPEjdvwjVj5kAV5S PjMOEDj3ZfJXvcEnGEqV7da4mCF/wCQfICi1jgqNZcCDhclANSZ69HIqUzRWWnShTt AUHm2elH5ys0JycPnWbjxBQSIciq9qGtT/wpP1JjwH7noLfsCZUe0/btayU+H2Dgae EYMS2xyrJ74CQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:11 +0100 Subject: [PATCH net 01/10] mptcp: map v4 address to v6 when destroying subflow Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-1-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1870; i=matttbe@kernel.org; h=from:subject:message-id; bh=R+BQBUEWiM2ym//t1ZB6xXS8N8caCdeWbnoDwiPCfe4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqwKTdW3PskIYPe7YlyeUTOtATAmZlVGcwi 6E30zx0XAmJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c+uED/9eaB4gK4ZdGVN/ncv+ZTHQGFKZc8N5XfdpyCBQ7NySR9oJDseOFt0HeXKHsP209jWimRf awMCdYlcq/LHrQEWj7VtM7FoTxN5ddBcncCUoocl8y2xdnlx4I8wnw4Qyj7dcEZAZaov4CIZPwh ufGDCMQ2Oxelnq6Q/04157J4I+pNLLw7Pcs29qG5LLvRgy9HoE/eMS1EiFT4tMxOYkIeaValWwx L05c4WmSzqvbv5djX0YS3oSjCzSyV2bKvE0AglN74c+2SwOWh8TDvpkRmdOfEhTcjYvTjA87UR1 hmfHBVdNxNq9gEXzO+lSPu2H6ZWSzHSOGyhzJOZVkRvzyt2nTXOrA2VLY5bSIj8fp3euwLHieV2 1QEumN/7GjmjfxoT3L7rCCAWK9TTD10H+e1Tc8fo+ilAU2igODZ2oJ+P2ypi5sX+Du/JqgcJLeC rA6LeKFMDDS1vKm540vUESZ5R17q+3+TPDG5FufdSiBcMVhgBctFpTaM+iLhNpyOjfqQuZlrCOy dy21Hsc/8kRzgUlbANDYv181i+GAMR+8a5SuP5dFrcFi4OoSCeXA2rRiPBmyxIqcW1G6WtRxYmb 0Zk5skwre+t3qr0Bb3wD/okVf06rybE1Vxc0JmnA9WBUWlstnUZLMGzZBmaZhOCZ+dkhQzNOFdP KMvH74pTCriQOjg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791708539438315453 X-GMAIL-MSGID: 1791708539438315453 From: Geliang Tang Address family of server side mismatches with that of client side, like in "userspace pm add & remove address" test: userspace_pm_add_addr $ns1 10.0.2.1 10 userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED That's because on the server side, the family is set to AF_INET6 and the v4 address is mapped in a v6 one. This patch fixes this issue. In mptcp_pm_nl_subflow_destroy_doit(), before checking local address family with remote address family, map an IPv4 address to an IPv6 address if the pair is a v4-mapped address. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/387 Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establishment") Cc: stable@vger.kernel.org Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index d396a5973429..bc97cc30f013 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -495,6 +495,16 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info goto destroy_err; } +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + if (addr_l.family == AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)) { + ipv6_addr_set_v4mapped(addr_l.addr.s_addr, &addr_l.addr6); + addr_l.family = AF_INET6; + } + if (addr_r.family == AF_INET && ipv6_addr_v4mapped(&addr_l.addr6)) { + ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_r.addr6); + addr_r.family = AF_INET6; + } +#endif if (addr_l.family != addr_r.family) { GENL_SET_ERR_MSG(info, "address families do not match"); err = -EINVAL; From patchwork Fri Feb 23 16:14:12 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: 205491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp688529dyb; Fri, 23 Feb 2024 08:18:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVpaV6JPIUC/lCE+Dc2z3Nhmn3E7BmnT9Eq1uYujEyqXFdkyf0yNvVRLOMFeHwVMEw8mECTKZ4VpYP3IQawBIVbSPsg5A== X-Google-Smtp-Source: AGHT+IHq4UwwAyJFNR57imMdY2cw/DfB2I+HHj8pHOmU7UXUBvoQ+NpkzdPD92a8LtXGzAA5YQMM X-Received: by 2002:a17:90a:ea90:b0:299:4fa7:71e5 with SMTP id h16-20020a17090aea9000b002994fa771e5mr279560pjz.8.1708705085889; Fri, 23 Feb 2024 08:18:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705085; cv=pass; d=google.com; s=arc-20160816; b=WRk5eSz/CMI6mLNoddO9AzcFBssXdCICW1SJ1Cd30MKd0U0XMxbPPW6fLUbfuT9Zeu OkxLldDlZL73xnFOgxzw5OAgWgvcSZM9Ty/soADbZLx+QxnVVYHq+RMM8p2hkpQtPz84 EgNbpOvHP8L+cCB6ULPKauQci/iiQiv5hYtxBqZcInIfmC+MeHES81CZuzYQViAnuEZo 7+sMlhVFtawuXs8Gbh2pSY61rdYO21hiN6iZQEGKProhLRNNbGZBdtZUHxJZxoZsYVfr uKp2idv8nG9mDbFzJH37gE1L2OZhQrm9jilXiJl9vAXglyrrgKGMM10sIAioDF2Oij4H bZUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=JKLYyY3YliXdnms1qvOfTw7ncgLOrhvmSpoAQ58kPI4=; fh=tHeEkhyqHGk1LGK1GVLG9H+11EfdbPltOPR7aCZnwg0=; b=SMCgHkyP7EP3CVLEUToAio7IDQ3gfLGE3ZCRYxi8M5zRWVT414+V/M4174U4BMpq0G oMhKGuw3QtOxFnaNfv2nDm+cnGwt0NkYxlYopwga4aLkcd+qt953a9deJnEn7oGuEu7x xGgLvPViHtT3TuJR0jlcJt81p0bDHslcsPovfkmle638DRwFCTv7tnOp1QSFBjWaezP7 8ZxXc+LUCm2y7nCJKHpDBxeNvIqas0JaNA51iPFKl26P9TiqPCHNW6/gFq0Zmzqn7zPC Zr10UwC/dmQt7/kGkgb0te8j6rSJqWsti6QVD1bGi2Oj3qs47IF+2pB4Ip3KNOyDXUMg 3GiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OYQjiqLi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78690-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78690-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d14-20020a17090ad3ce00b0029a6469b14esi1362517pjw.189.2024.02.23.08.18.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:18:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78690-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=OYQjiqLi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78690-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78690-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 A63BD287720 for ; Fri, 23 Feb 2024 16:16:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E72012D210; Fri, 23 Feb 2024 16:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OYQjiqLi" 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 0E26485C53; Fri, 23 Feb 2024 16:14:46 +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=1708704887; cv=none; b=k0m7SrUUxNOw3DLY+9Hgk14Ceprr8baw646e8BSZo3uU/b6O7lCFb6Z7iBB7MJW6GsMecVO40G3lsbqJzsJl10sLlLazetqjfkVk8SWANOCD2QewiGoRIQYf90ERuLs11RMyHHNvYjqHg0Gp1f60q6ZcO6t9hDGhWqKd2cDm/jw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704887; c=relaxed/simple; bh=ue5sQop1UX80N3Oly9X4CFXlH4jZY6ypbaPw8tp4MNk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dEgRYozT0Q88YIW4SNdC2a5Vp712qf0Q10AgpCvexCOLYyJOcnw4I/0rVRnkEgyWe2yCif2L0Ua8OIhirbr7CqgcLd2z5QBRxq00sSSxZRSyi/K52gEapBam4L+QJ9LCn1q28/GxRRATHZ3739+/TuVDcpInUiz/W7UsgD9vnEU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OYQjiqLi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14F7DC43142; Fri, 23 Feb 2024 16:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704886; bh=ue5sQop1UX80N3Oly9X4CFXlH4jZY6ypbaPw8tp4MNk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OYQjiqLiSpvM+OSw5U4180OTYu2K26nqI1OOcVnhZcPjuFTcHW7fx3ZOq4tq/hhj9 JrEniQ9mW3MVh1IRfbHDC+Zrt2RMEcKcD9vTA5GkgZKXa7NN5nBmvfWWf8NThmmQer XNUpZPo/DZvOayJeETWkt8Q+jm+xz3Xo7OGtGZHBHXtYoeAppzTcrbJj+lxXJ9DV/d 3ipgHXmL8F+qO6jw5+PpyuTpXpf5slB2MmqdVteX3YdrhVdqpIKk9EUj7GdGLK3KVh o+PKYG991i5JWw3BCdYZVOWpyjyGEVjoQYLaPB7tcviZFXlxWthnEXupyxQAuUoven 4ieaDepF9/w7w== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:12 +0100 Subject: [PATCH net 02/10] selftests: mptcp: rm subflow with v4/v4mapped addr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-2-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3748; i=matttbe@kernel.org; h=from:subject:message-id; bh=ZFk6g5PlJHfh11TlBjZmbnSS1q5EvGF/kQ+zZYNGb5Y=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRq//6S05QxDI1G5XsvbBsehgLjYNABsmmvO oWybwGvJYyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c5KQD/92c/GlnMe7YDrf77OPpMvOybwPkaZgMchRNsMt5DqXM0C3dSRihG+iEXnRg3N/kq36R5E 6XlsivfJHTS8hptn5iw5S2tzvONtgUAtle+kl/HcdWp7VS0AJbM92PRhvuxOBHRtsny+DjkvE0J R9+qIQapN0y/oiImFrmumcUJhZLJThoU0lHvLit6/5/mkJcZDJRleC1qJoreiNFqwqNQqfjMir1 pMNeFDrU4jGhIo+t5pH3k0H/n4DmkIZf3tGT/ZFKOMEqjz7YKmyxVW2KrEygvx9RT81ErPTpjOv bITRmuwaQvM8Sd/A0BbQgrAnrzFYdLy76GWF9Hw1IIr6F/UVDVek77TaXHnpuDAAthMgwKj/k4X RehOQb/DotcD5xHr31JJ8ko63iQFPIh+ZwjhjkvpfZ/B0WtoSKWEnZdwv+vhTWvgocC7YoU5SvA 2wXA2QVAGJ41cBdZtI2rLIzZVMfkUt01iAo2ZnEK+T5y8efxKVmaYPr63ooIIzLI8eFkn8ZYhT1 IVUPmDXtK+ZKvX8Kr/wBTR4ZPPvQCZ3LRdCRVX4MaEA22FiL+3L3fIeu5UfoshD6QEgg3GV90Ad GfTVQ60aZ+IeF2uYedQukbC6wyqsX1pW5re2E3Gv9qOF9yxrXJsD8SRMLt5pJdtjWGEBZMOqaJl 7X5etMjhYRy/8Gg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707144049208447 X-GMAIL-MSGID: 1791707144049208447 From: Geliang Tang Now both a v4 address and a v4-mapped address are supported when destroying a userspace pm subflow, this patch adds a second subflow to "userspace pm add & remove address" test, and two subflows could be removed two different ways, one with the v4mapped and one with v4. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/387 Fixes: 48d73f609dcc ("selftests: mptcp: update userspace pm addr tests") Cc: stable@vger.kernel.org Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 28 ++++++++++++++----------- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index c07386e21e0a..e68b1bc2c2e4 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3333,16 +3333,17 @@ userspace_pm_rm_sf() { local evts=$evts_ns1 local t=${3:-1} - local ip=4 + local ip local tk da dp sp local cnt [ "$1" == "$ns2" ] && evts=$evts_ns2 - if mptcp_lib_is_v6 $2; then ip=6; fi + [ -n "$(mptcp_lib_evts_get_info "saddr4" "$evts" $t)" ] && ip=4 + [ -n "$(mptcp_lib_evts_get_info "saddr6" "$evts" $t)" ] && ip=6 tk=$(mptcp_lib_evts_get_info token "$evts") - da=$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t) - dp=$(mptcp_lib_evts_get_info dport "$evts" $t) - sp=$(mptcp_lib_evts_get_info sport "$evts" $t) + da=$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t $2) + dp=$(mptcp_lib_evts_get_info dport "$evts" $t $2) + sp=$(mptcp_lib_evts_get_info sport "$evts" $t $2) cnt=$(rm_sf_count ${1}) ip netns exec $1 ./pm_nl_ctl dsf lip $2 lport $sp \ @@ -3429,20 +3430,23 @@ userspace_tests() if reset_with_events "userspace pm add & remove address" && continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns1 - pm_nl_set_limits $ns2 1 1 + pm_nl_set_limits $ns2 2 2 speed=5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=$! wait_mpj $ns1 userspace_pm_add_addr $ns1 10.0.2.1 10 - chk_join_nr 1 1 1 - chk_add_nr 1 1 - chk_mptcp_info subflows 1 subflows 1 - chk_subflows_total 2 2 - chk_mptcp_info add_addr_signal 1 add_addr_accepted 1 + userspace_pm_add_addr $ns1 10.0.3.1 20 + chk_join_nr 2 2 2 + chk_add_nr 2 2 + chk_mptcp_info subflows 2 subflows 2 + chk_subflows_total 3 3 + chk_mptcp_info add_addr_signal 2 add_addr_accepted 2 userspace_pm_rm_addr $ns1 10 userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED - chk_rm_nr 1 1 invert + userspace_pm_rm_addr $ns1 20 + userspace_pm_rm_sf $ns1 10.0.3.1 $SUB_ESTABLISHED + chk_rm_nr 2 2 invert chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 kill_events_pids diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 3a2abae5993e..3777d66fc56d 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -213,9 +213,9 @@ mptcp_lib_get_info_value() { grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q' } -# $1: info name ; $2: evts_ns ; $3: event type +# $1: info name ; $2: evts_ns ; [$3: event type; [$4: addr]] mptcp_lib_evts_get_info() { - mptcp_lib_get_info_value "${1}" "^type:${3:-1}," < "${2}" + grep "${4:-}" "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1}," } # $1: PID From patchwork Fri Feb 23 16:14:13 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: 205492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp688707dyb; Fri, 23 Feb 2024 08:18:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVbh/W1mt34ENRTW7ZoeX+dzIJX1aOBrQjuqwPSjz0pnc8KAwB5yM8KlkcY0P0ahqIiuoVZvyigsgcU1u/QpPqbH6huHg== X-Google-Smtp-Source: AGHT+IG4EXdvfNfwjNbi00JltnB0107DdNTz1Tdg9hQIDjYoVA8ohqtXgRr5Ul3cNltLa874hNlm X-Received: by 2002:a17:90b:3d92:b0:29a:85c0:cf18 with SMTP id pq18-20020a17090b3d9200b0029a85c0cf18mr345719pjb.8.1708705099708; Fri, 23 Feb 2024 08:18:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705099; cv=pass; d=google.com; s=arc-20160816; b=APd4YzJa1QUsZSljcweBVIqeuHKKCNW8mLnSuAcFbXBLZ7Djw/P/gqGOwhd00kcoBL 9oZaIHxPgDvhG9AlzsCIgmRZ4Qqj4b6EUBIfTpm5ugBmn1VzQo7rJxKd18cyMhGEDe8z 9zDXSLQJ8kTmCNiuIKNztB7axV/8s+hk+lJ/O6qy5TaMELCUJlQIF1CsX2XYTx7c2Pj8 6DMbRq6+O7Ek4KawB6WOy6Nn9UTFXI0QF3aTdZhDqIsR6xwpPpK3tN7QxeghIAr64l+e Z7oDMJ/vnbeedfoRMaKUFT/RgA2n5K9RBw87TUcYnut9DfTeNqCDXaZJWzULWCa9J5RV Lz1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=GBaVlBjHZ7VoPhzAupNCi89h/XzxEkT6p0uLTMpXCKU=; fh=ToGV+xC+odn978/seKM04ODnJt/4Ke0GvS9hN0caSHU=; b=XZsceIl6Bk/8Vo+7zivpTVW1agEuuwsaAed/LDjz2AKcedCzwiSIrlkwbvWV3TyJod Y533XAB7a1D7cbHcoiP98UXYvA7ccI/9N3E+qsPY3l+R0Hqt4J6LkMg7U7FFavcjxJ+z kI2LvquKL7HrJCsUEi5pvvlGlCE7Sic1csyctKQuoAg4Cszjk8bK3/mWiEF93/IT0JOT PFmxXLeBXpiu2rVufH3MAtk2xbmRuZ7zBjncxHuLzsPpNkvMeTifGthlfdZ+CnZmD3+O VNK37gNANmcAyesX39s/t0McuvX9Xk3yG3MvwcUlOWmLKoSRHu06i/qcgdF3YoNmtKAw gRHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rJL2laFc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78691-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78691-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o14-20020a17090ac70e00b002935f38dcf1si1395035pjt.181.2024.02.23.08.18.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:18:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78691-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=rJL2laFc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78691-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78691-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 BEA902898E6 for ; Fri, 23 Feb 2024 16:16:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C35D212FB1A; Fri, 23 Feb 2024 16:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rJL2laFc" 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 EED7D84FAA; Fri, 23 Feb 2024 16:14: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=1708704891; cv=none; b=O38IKOTu8HI5sDoahz9AXu8LSGv5RDGBBekVWn5qIAfPgekZ3PYRlurASFBwv0+hWN6LKVA/XvMOgjo2I347ebQiuJlhVax7zb7Cl8c+1Fo2TDKOQrowYZJUaPXUNu5484zz+oEFdG/uayBx76S5BVPsjn1/uVbbtZGwX9OfcIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704891; c=relaxed/simple; bh=yqVpPDEMqq8zK76y9/RmkaivQjX+jkMnWSVK2jv/tQg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eYC5kxbHKrFnRho1b+dbXLOh9X30QRJDJ7GmIzHMMaFywTqsKO+JOy19RIgxSP6VJZaXhpOrZvqsXgZWL9xbSe9PRlXI3aBykzdV+nBCfDSKsLlH91EBCJKoGExEGFr5vn25Qb+MrmnEz1HwUIAEWO42/TC9YBCRQaKBiYIs5H0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rJL2laFc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 121D6C43390; Fri, 23 Feb 2024 16:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704890; bh=yqVpPDEMqq8zK76y9/RmkaivQjX+jkMnWSVK2jv/tQg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rJL2laFcQJvQzSBN68I++1KDdpnbpoFHC5tniRy7U/iyPwSTUfKyuDjkPLbaWwq9g uoFzvarctpfa5tXnqekNcM3DBaLIlctwRjN/DIMLtDb+C9zHUTCu8RslzYc+hSNreg wd/gkpLmdTd17H8Ctr/24cr3dD97jEjKqCsD622zxeeWdz500mGPFSR5iEM8KR2CIW l6l0RYDuXCbXlV7oUEljfkFdwqRYMC16TEEDtziNw9VWR4jsVm0W7Wy8aP1Abp6o/z b0tXtARfUvWsqbpR8RCemUfmrOPjxZ2GNO1iDoFIMMZ6WJhS+X6gkXMygS3wCGWLiY kqbTsVNMXxNFg== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:13 +0100 Subject: [PATCH net 03/10] mptcp: avoid printing warning once on client side Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-3-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1379; i=matttbe@kernel.org; h=from:subject:message-id; bh=yqVpPDEMqq8zK76y9/RmkaivQjX+jkMnWSVK2jv/tQg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqWg0B1Jjp3HzUvASfzwT2t8eB6Fif+NvbI dLqtrIJcsSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c3cZEADmMRbSTC/9CnNeg7emKx2DvjHpspiVlqu2nUM5x6yWnhKyia7OM1BvZMY94o31oWDzYcL cd4AeEF/sE3Yz+x0mGM3gEtH/NCuNjXXv6I6el/29kmdx+7CAGscV3k0L75wd3evuzQhVieXNq7 /EC54fanr/EO154BPDq2FJ8TzR+CaJJMMVIe473/vggq8R/EifQFi/lXBl//HHa5sY0HFZNCkM0 vwJ+jJxxe2MGtGWXqQqIGuePYBuhbmU+7nR0GgYOUE9G/V4AFi/nx9MOddb7ek9zdEOjgVOXRgC pQyMdPZWlOXKEw1kyLnUligfJLPIL0PEyPObI4jWaC0j5efzqy4+NZS+WnULWJyB2QD70Vf0hvI TPWqLzhIbrHEqetHNF6k2CGQjD65B7msGkPrK54OX4o7ME8+gfSUALJMimbPTilZ+5zdOuoPIfH Kaaak6/VGqIrO0hmAQ1jBTr3YfhIaxxDYwBa/7oo2PwX+sfFSEsHYlzY6rim2JMD/XEUK707fMk S+VKFCi7C+5QeTlQjFNfw/FnmL78vvwQUzCWTeCZRIS56qZ8vve2LbKrNd6yhpkCFQ6uxnAt37C u2qSDb5BhPV3LbVj19mlq/wFiU056rcf0lBmW94UvoOpclSYgTu83Dqm0dyTSzj6LSvOqOWP97u Iwyc5cVo8Syjjag== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707158592855402 X-GMAIL-MSGID: 1791707158592855402 After the 'Fixes' commit mentioned below, the client side might print the following warning once when a subflow is fully established at the reception of any valid additional ack: MPTCP: bogus mpc option on established client sk That's a normal situation, and no warning should be printed for that. We can then skip the check when the label is used. Fixes: e4a0fa47e816 ("mptcp: corner case locking for rx path fields initialization") Cc: stable@vger.kernel.org Suggested-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index e3e96a49f922..63fc0758c22d 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -981,10 +981,10 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, if (mp_opt->deny_join_id0) WRITE_ONCE(msk->pm.remote_deny_join_id0, true); -set_fully_established: if (unlikely(!READ_ONCE(msk->pm.server_side))) pr_warn_once("bogus mpc option on established client sk"); +set_fully_established: mptcp_data_lock((struct sock *)msk); __mptcp_subflow_fully_established(msk, subflow, mp_opt); mptcp_data_unlock((struct sock *)msk); From patchwork Fri Feb 23 16:14:14 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: 205494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp688860dyb; Fri, 23 Feb 2024 08:18:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUHhUY5yjtB49StPo2KTT6igmr38NhLeOBlEZJDQ2L3c1bpgaFcUJ8u+i29Aa0Qg/Ebt3TlLIXD6jQ358KGlhcfmrA0cg== X-Google-Smtp-Source: AGHT+IG258nLz2S/Q/kCQSpg9mdoVME59y99gYV68Oc2+D5grzFD8H4IpZpJ69Ari/z/smwA/x+O X-Received: by 2002:aa7:d297:0:b0:565:6bbc:39d1 with SMTP id w23-20020aa7d297000000b005656bbc39d1mr181102edq.5.1708705115122; Fri, 23 Feb 2024 08:18:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705115; cv=pass; d=google.com; s=arc-20160816; b=u9fE/g96iPSO+VPxAfHdJK2Umhv6L1BO/T5wIVBHsbHYDO7k/D/REl/gqAgMeRB9wU aphp0gB+xQgKhMOFkDb+K2zon5XyKzcAVNYl23KnPyyyJlvMT3KVRTgo7jybKcV1gRG/ ATJmyYq6AzCRsu4XqUxdUhUE9E5Obu/kcmHlX8/wgi7P6b9fdNfGcxax7OZVl7R1vnRv RXKDm6+21c926uSP3rH+4stlTrg8hq7oXzm6HEED9y3TBcvqivWwtKSTxZav6caPoplk /PKRmUrr4k67XPqO7y8WVTc4hHIsIezlO3aHD75dhyhLGr1DkbamZ0wCuvLzDGSbcz2e pKMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=IC9yt+zqF1jJ4uoGUR+mDAcQFUebhDDuUAvb9GZ8Pmw=; fh=ToGV+xC+odn978/seKM04ODnJt/4Ke0GvS9hN0caSHU=; b=FFACQN3HEebhrg2No/TCVUJXw7hBADo49MPuRNjO9EVsx+Zh7r15NLiGM0IYRqu+WK MlvKxDM0FJd53GlyF1xDAl446h/PAe/NP4lSEMHJ27S2INyhkxYIHmr6RoG68/VbG7I9 knj0Wjl/JzmJIlX32PSsL8x3BA9xH7iBjTF/vLoz8H/78aNyJNzildl2mKWIhFZ3ZygE lHHqLe3mVtfb5DkRRTYTG/Wi0r+YsbHSBmsTPsDeYDtyAjJQZ6YGGkUz1ViW5zWszU6J 5UH/6VrWI67m2mH4yJefXeIDHl4ZKf9ExQrtJ4SIDe/pS2j6GDQHYAK5sKrQjPQe/2oK xhiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k+BmOVmG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78692-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78692-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cw4-20020a056402228400b00563f58848e3si6169035edb.125.2024.02.23.08.18.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:18:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78692-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k+BmOVmG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78692-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78692-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 42DE91F27061 for ; Fri, 23 Feb 2024 16:17:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4FA8134CCA; Fri, 23 Feb 2024 16:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k+BmOVmG" 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 4F22984FBB; Fri, 23 Feb 2024 16:14:54 +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=1708704895; cv=none; b=SeDDY1ahLKFQ0ymCEBLVlSS6VTWGeMovLPP1spiG3CqjzAsHpL1Xf+HSIx+vJdM0FG93adYDrA1Zt3tX5+EhAwWi1V1Kyk8kVA1hdXEBR7GgfE0ZJfuMbUZvFmkXLMsldI2ZMjHOPcFf1iaYfrDjHDR1fNH6i6wcMboeiIV24j4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704895; c=relaxed/simple; bh=oMPcTg/HR4My2+n2kEfVTapwJZ1FPd+w13TvTlMGAjU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eZVyIt0zf5OfbzR5Qc8aBZF4m4nXSMv9MZWDrBBg3a1bDKNZ/Xh+BhiHANUpD6kusNtrfjRb3l1KyXIMDCawfAu64k1zS5OdAt89m6Rm4Vi/5CG3tvlj2ivCoi+0EQRgUz+umIyPLoLMQRsbgCN5+b8jIZ972KdmgFEj7xHsp/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k+BmOVmG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9455C433A6; Fri, 23 Feb 2024 16:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704894; bh=oMPcTg/HR4My2+n2kEfVTapwJZ1FPd+w13TvTlMGAjU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=k+BmOVmGu1WVPgWV4tYATEy6Do8BYxMpQTMFseaweyFcBFympiJdfwoRAewYGG3cP SY6EPq7p2y/MOVlxvpFG9jDXs3D0cfFUBVK/HDCHQkC1wVBv7nIPYVlERiEPrVQQfI K49wNZfJ1CKShcWbTdtD/84xXoLo3WHAqrGSrBqFOy8AMhPS4xisKyzXwnWGcyKI9A 3viuMXfqbT3fAnf/t4wOA4x/z/UWd5vxDvZcx+afLvzq0YNiFe19fowsc89Zxcmyow b+r6XGQoScDX5GgaorUKEGoOldDxch3BvMfp7rJJ33M993JWCroLg6HeXgrlJmN5HY 7syt9QjVvaG+A== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:14 +0100 Subject: [PATCH net 04/10] mptcp: push at DSS boundaries Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-4-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1234; i=matttbe@kernel.org; h=from:subject:message-id; bh=LIWA9w8Hu+BN9Y93ANJ69iVx7kuDZyfmJaoFzfkKwwg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqohB1/YeTq+OuqgfAFqE+ePW4jlRE5MgU5 dBhI0B65D+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c8+gD/0TZOAF6HLWBlDgOkRrcVEyvyirDvqagkCH4NhEHL3pxfQ3Yss/bShQ8PAtfjS4x58pd8G An5gZ/9oMnL3b76r/pphg4y1m+h7yJct0Akv9tNRXzlvHmXhkZdqpcrUrjInpznaDKcpoyrtRtc fG4yHBe9Pux/Q4h9BvvnoVhxGJCDExtd/tgoA0NbxDxFx2ACwifYshqjVVVkLCyNrc2d3p+YjUZ NVcs7O4i8S2OMfddssO1IsOSQUJBIj4KbVOqgFWBofDZtsfdxkMM51LPRDltbj5DK3FCdCXOLG9 oyeM0BEz576RQXnZ6v2cNFhmYRjYxnqZgkiXu+wEIMoX42OJDkbA8TFvDhBQONutMgLAJyXCfq0 vvYc7LVRI/oU2Gy2eQi388Wy6h4oDif+NOMhbqX+Qb2PkfIMH0hM3rq9CV6kUjpsGt8/zG4EDBf JkQ121N9cBZRJBWGrhB6rO0JRAdei25kj0uHYK/HthmaBZkEvBpAP3GJ+VNtRrLFTOj6Vfn/jLU U2vyzeGvCDMVnRTuCYF0bkjAkS61cTtGq68biANBrHODMZh1Gcnz/eUbgvPKizuWXWERBHHH37K NMASOEQ82uSbYJTRVgjhV5D3atJIvnVpuRBlanPJ+Ptx/DiaIp6ox+wiIjGDMOcp+BH0J0aQh0S c2hEkViXtfrVC8Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707174481542155 X-GMAIL-MSGID: 1791707174481542155 From: Paolo Abeni when inserting not contiguous data in the subflow write queue, the protocol creates a new skb and prevent the TCP stack from merging it later with already queued skbs by setting the EOR marker. Still no push flag is explicitly set at the end of previous GSO packet, making the aggregation on the receiver side sub-optimal - and packetdrill self-tests less predictable. Explicitly mark the end of not contiguous DSS with the push flag. Fixes: 6d0060f600ad ("mptcp: Write MPTCP DSS headers to outgoing data packets") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 948606a537da..442fa7d9b57a 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1260,6 +1260,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, mpext = mptcp_get_ext(skb); if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) { TCP_SKB_CB(skb)->eor = 1; + tcp_mark_push(tcp_sk(ssk), skb); goto alloc_skb; } From patchwork Fri Feb 23 16:14:15 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: 205495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp688892dyb; Fri, 23 Feb 2024 08:18:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXnyaIUODeJBhZ67nz4Nj+W8Q7Kv3Jl2CV2/osLhzbc9q2I8SDBpMR3dVMZDZTSFC2OBEfz2VhVn00NsIGiMFxAfxOyFw== X-Google-Smtp-Source: AGHT+IGpHtf7NoEyZkdDygupOnsu7ciLIByNbVp6ukJEegivBZ2iWkXHgcc8Ip/vFoUy62XM/nxy X-Received: by 2002:a05:6a00:2da2:b0:6e4:c5a1:e41d with SMTP id fb34-20020a056a002da200b006e4c5a1e41dmr336691pfb.29.1708705119169; Fri, 23 Feb 2024 08:18:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705119; cv=pass; d=google.com; s=arc-20160816; b=Lf8B4xxESFwNLUXKBSHxZT8uayJgX8jD3RmYiBqYh0ri7XomiaI0qTBDzIQN4b24gy 6GEhBJ1UzVZyrzHdJC9Qy8xiK7TFn6rkolXXmRWIaD9VJyAb3qgRH7tqGF8QLHvXTsHE np/tMY1g8qGzBmJVcB7WsUSO4e5O7P5C8EMg9XHqR4ruDVOEgWyetDnb/FRbhPAXANbO u11Dbgfp76PD2VrdlWxqeqOMa1Op67+0jf97vN3lL3dnYbP8d6bL7nYW1awwN+UdSopI LBMQV2AaMfAmWwkfA37MkyhA1NKF4wpIne+S/Qv+gQJ98rutO3Nv6lwXjVnkgVDqQpFI Tvtg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=w9vxv50N8f5QLOT3sa05/uP/gErF4PZW7BUtEHlTxzI=; fh=ToGV+xC+odn978/seKM04ODnJt/4Ke0GvS9hN0caSHU=; b=ttfS/hI90HBEQxyHh1EtldSI/XOzaa5iuFsPldGDYhHO1BRlVN4+6+fS65QiNPQG/T RQ42JC08zzFta3BBZYuK2pB4D9s+zV1XjzS2zSTV6xTLY0y8Y9t4T4O/Ow/Jbj1+1zqs HmAuN61EroIRv5YqEyQNxQ7a3WtEFhl9weoEl3en3q25k02qIrXzeR/01OOJU9veomal Yrad7ZOhO9VkJgSmrFxOeS/nexGMsb4Fi+Rxxn47DCRFFNHMmIKCgO4WvNQA2WBHCHgu +DFnEaZBw4XxpbjJertBEjko4l1a8V9tcgG2yLgfdBN8LIUUtfQ/6zmBztuDmmIv4emU /kAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BUPjmnLG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78694-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78694-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x16-20020aa79a50000000b006e3261ce292si11635482pfj.253.2024.02.23.08.18.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:18:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78694-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=BUPjmnLG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78694-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78694-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 4ACAC289D51 for ; Fri, 23 Feb 2024 16:17:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E1C786151; Fri, 23 Feb 2024 16:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BUPjmnLG" 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 6173012D217; Fri, 23 Feb 2024 16:14:58 +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=1708704898; cv=none; b=feLp0ItEVShUBUMm9Ug88vnjse8sRGZDt5UQOMpIymfQ8J+HoWs5/l3HQIah8F/BBpJsyU5Fw8FnG+CKcQASHyeRB/AhtTIIresGqwmAL/kFLOgqM+4ivC2E7l4I/Yeu0dIWh/K2nTep2C/9cPOIVvp6OPoyfaMB/mYHXoF+2x4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704898; c=relaxed/simple; bh=CPDy4dZRwTDEbx1YV7BtHTXQsWFT3BnDEbIFrcORF/U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nwBbSZsKAlHN9J6ntBZFCQHLir7FL4b5J3twpPDmJakSATE6wq2fIEexO7s+/ShUsyE95v9xCz5jyEfq+p+WpIHTBVsnfqgmtMtemOTiizlkHekrg79CSKePb/NDhE2XZ923aAr4TniPH/EDXFnxK2RaLgtacRm32v7hVytDuEE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BUPjmnLG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6DCAC433C7; Fri, 23 Feb 2024 16:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704898; bh=CPDy4dZRwTDEbx1YV7BtHTXQsWFT3BnDEbIFrcORF/U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BUPjmnLG4EEmoVkbZHiYUh7NwbhZCFW8cRCOI8JkXk7KNYhfGf0eWhjI2Q4DpQ/Sw XMY0eyyGd1RfmIbrbIzd3NFYp+WKtM+NIlG2C01Us8QZNDOqRNh5fAO4f7F3AlQ8yV ySICiAGPLUSnxezVUpRAaav2d5y23+HnubAlYdyZgaPmllyKKe8BFOdBhPX3hjDzA8 6/tiZMTWf0PP+aEn/P9qKzM3MUasfUy/MX5szPYDtXqsg668tWv4DL8pXQ3mpqYFBp xhxAq2vd6I44gOrualYJsG8nrhbRabcc8/tqkdQQMo881/k9Sa75UhGNvwPAuA0PdV h7fkDmjtsxDuQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:15 +0100 Subject: [PATCH net 05/10] mptcp: fix snd_wnd initialization for passive socket Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-5-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1025; i=matttbe@kernel.org; h=from:subject:message-id; bh=zIc0DvPqwvck70+qa3G7AqDo3nn6CKmR3M+FTdYp/kk=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqFg1UztakYnL93CqFyVtJ6zltzN2Dr5BA2 ORlY27pbKCJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg cxXGD/0dD0CgsDVdaPHL6m2LuFAFjfFkSA8ug4hqwJ4GqD7EiIpES0CraAvncxkciSjNhcpuesm ySM4ZvVEM3bzupke4g/8zbrWuxUPaDA1BVPEPt7tqfK94s7D+LWmVVyY3zJVr3M/Iimycecqma9 lQ2zmQ1n2glNN6wufx2rnNoXMlCgvo5kTlv8p0Wt9wLMNKwk0Po1Ff61mJxglpAbBNuZ2F2RvO5 Hk6DqPEsGpk5eZQW03ZnwQYxP+RvwtooQQ2X+htxX1vfHWrIaNxuwBjVQFIWtOmGODQyLMncDaH aaD2YeYzxzXT3Q7X4UzQWcsuBFAvujsfb+f8evylOhoBmJ0y1mHF5j0jmkC8y8l7fTDTI7V6p9r JhZ6nLhyArvLuAd9xpFaMPvUPB3x4QPkDCnqjPpRhMWHzqyWIVfEsv6csb4kWs3K0e3qSOrVLa3 PV22ytZblYDccuv5aXNECi3Vcce4NNKpZnDmvQzXY9RCJJyG7tlZ+FeRUbWqJXbX7Vwzp82Rq0L 4Gdkrfzsk2ytzNj3kSXD9kB/XxvDyfaTn25bya0oTCvodbUYNXwTTQiFu++LsV9UghyjkSVuMTe 7NUTSVi7BVhVs4UGC324V/8sZ5j+706CxoXYkQ9A7mVVg4I3Hw73qjLl5a374Wy8eYCQAUflTDP z3l4epqYIK9HmNw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707178859827416 X-GMAIL-MSGID: 1791707178859827416 From: Paolo Abeni Such value should be inherited from the first subflow, but passive sockets always used 'rsk_rcv_wnd'. Fixes: 6f8a612a33e4 ("mptcp: keep track of advertised windows right edge") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 442fa7d9b57a..2c8f931c6d5b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3211,7 +3211,7 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk, msk->write_seq = subflow_req->idsn + 1; msk->snd_nxt = msk->write_seq; msk->snd_una = msk->write_seq; - msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd; + msk->wnd_end = msk->snd_nxt + tcp_sk(ssk)->snd_wnd; msk->setsockopt_seq = mptcp_sk(sk)->setsockopt_seq; mptcp_init_sched(msk, mptcp_sk(sk)->sched); From patchwork Fri Feb 23 16:14:16 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: 205497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp689032dyb; Fri, 23 Feb 2024 08:18:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUDhb2stuWyMeaufNUCfip7SaP9nXGrpMU0fXr4ZMKUHDIoSTh+kxoeZ2rA9OmwV8LcoXNmv1YvhCCDJhdoTZDZsaRXZQ== X-Google-Smtp-Source: AGHT+IFVCEPwHue37DJgBJ7iOxVPRcOKcDjLSTm92VaRPPhR/5bvbMX4RnY0GxvvNJXnrbjLw9wC X-Received: by 2002:a05:6a00:6c87:b0:6e3:2727:42a0 with SMTP id jc7-20020a056a006c8700b006e3272742a0mr268072pfb.10.1708705131717; Fri, 23 Feb 2024 08:18:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705131; cv=pass; d=google.com; s=arc-20160816; b=Stk5DCNmZ1CjmvS9yWha0PmFM1b8dxjwplgXPl/jLkywm3ClwAdfdM+DlBLKb/vlii 4mm6JUbXKp4gPdO+Na12sS8pZIrEdVXqkbyyCN9t9jn9Obf8d10Sg5RgOBGnV9laXF3A ufjPeYb0w4uUf7DDH3IDXjcEfJSu2vs8tUtJPOsfauS6sh0nnFuu8RNF6kn/WLeOLFp3 PHx9uNfpqZxjitMRWDQe0w361KCGyNxJKsP9ODtkCXQOJirwPL3kFXT7S4Z/lM+Gl7id u84sbEOErEe2d2EXzl9OxjEK4XHkm/ZxFYASENVOsgQpDr6Gx1mWTsMnU3VO3gS81CQp DcFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=KDGBENzxFnMH6j8W10AHIyM+ay8n1/ZQxmA/jltSRUU=; fh=ToGV+xC+odn978/seKM04ODnJt/4Ke0GvS9hN0caSHU=; b=Yo4aQ17/EdPQKnsSAiNhoO1FwcKIMR5vjxtGgGRmxAicxP9HbZPx39BEyIAyNgIjuO s3vIG4+V58KVBrjyNbG1X3tLOLj9U/hRTBa/olWvrFlLTgWPltdCBk//5tYqQHsVtXMP TgJ/fGtSTRt8+aWzLxSwTVmOJsYoJpfEKzxVYegVw8pVxJwmVE+Jo5RyYtG8PE4mKg6V roDkUpfVywXUXcGm3c2Qb9u/8+7bRz582Bsh8Ebt3muKf3LjNLzY+zLDcfQQ5s7rfXKn LA6aMuLenHqkN+1ywMef4eyxGtWvAt8zmvRJd1dPyl4XwD5KFU0/gpZEPb7ltq1ofc1d Xmdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OvgOV89T; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78695-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78695-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y124-20020a636482000000b005d8505c96e1si12245914pgb.423.2024.02.23.08.18.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:18:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78695-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=OvgOV89T; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78695-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78695-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 DB4CB2852D8 for ; Fri, 23 Feb 2024 16:17:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8DB512B177; Fri, 23 Feb 2024 16:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OvgOV89T" 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 607F21339BA; Fri, 23 Feb 2024 16:15:02 +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=1708704902; cv=none; b=UgQ4+Ii04giTtoRxApBBPd/71AbfvWxssQkr+lu2R+yB6fEyxjXRLVcqVvRBfAQVC0WOxe9kp3qbu6+IXSMdfFgI99bz+r7rX6Ow/FDnBhgLcb4tNDYKA6fGq8G1TjWPkQBy6jO+87ZpPGPaOwRZ8akKH9rV55CIfL9WpTUscF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704902; c=relaxed/simple; bh=PMAgnDXhRdjsNXlI4ncyw/rBYaRC4RspgOy+6WHSdWQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f36yjnYO+ZWsNFYFGUmIGyRo1SWlL0w3q4enB67LR7F7N2Gir6oT/Wow61dHpjwP5tRkGM0k5IIRCMbCnOlT33RqtRmLeeT9q17j32wpckUnUWYarx3kyhXWkine/86odSf0NVB6CGP04W7tdoK+ZiDAHgPdrJyVJHK79x/F1k0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OvgOV89T; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74A50C433A6; Fri, 23 Feb 2024 16:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704901; bh=PMAgnDXhRdjsNXlI4ncyw/rBYaRC4RspgOy+6WHSdWQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OvgOV89TM45dHS4EJWpLaYraLn/38cckE4E+eT3MCuPy8SwYHyui++rb7pCzY5+S/ Oxh81DF7cNkEgKb7o3xNv0/s6ZCMZU59P+zYgF9RNAOPW0Ie4DjX4GtHHeWc7KXZVy vhyTFkExltayTKpfA7EJez/XktuIvuVy7e2Iet6XG2KyxfFmT1KpB0VP4QnI7rVgNS 76pM+zysvpM3+dgoDKokjUJxzhTDpGnmoQUq1IbVzXhZc2+RKd2CenDnlKfuC993gQ 89/Qk8C90Q9aLpTE5L/N99QWj1T3vwSf48UM/M8Ip2FtwIEwD7kneSCgBQFLjnmvdN uEp9laIZmgANw== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:16 +0100 Subject: [PATCH net 06/10] mptcp: fix potential wake-up event loss Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-6-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2127; i=matttbe@kernel.org; h=from:subject:message-id; bh=g/43TBB3hrKxL6qqQvc2rdv93ajqIAHOvqscdy4uC4w=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqCbiEqi91LPDSjON7evvjjl9b9JVJOG87I M1OsGNpSQWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c+w9D/93xfwHlSJBSVqSLBT0GCGAdy/yW9dEoRKB5dYOpjitE+UaPM6ahF4MDr+d0oifWMkOvsO d3gKJvtohzSE6ngKrEUVgXuDVaDhT4wSEq5mVAjdF5Y7Z27gHVB3CCkWwc8qm2OmeVV7nE7i37S Rz7rS6ISlpyFwu3mqEFtbN7+i8x/OPU5SuPHftYOsb6tjnIaLSXSNgNmKxDFd7iw0SMrORhwzMM 1k/lixDMZfCPJfwacw1HAhMJfPhaVzWy+aJ8YYSOd4Q1TE4fegKjLpNttYITlUiJ0IEE1sd+xN8 PwTSXDHXkTTPcBY5Bxukzby3/gka8zoawTTsh19TRXF0yUftyi7S+aGftlTgDWRZQvV4chTZ3+P EJ4hIyGQbDvjkHjPoBMOWjZpfAXmGnLJ3BXanibfIUMTTHE0BU1MnGWPERd1ONBLNrqasU0dVcB 6AVr2TocXsR8mBRz9V5YR/Tn6R+MWSaggno9lCEFHQsP33zBi9FUCpzRxH6Nk/zQmDZwn/2bEh7 8NRmVDIqjX16L5Ls+k0InABhdNaGM5UeqI765EXlffFKWP+nVPFC7cV/yDG0JgjpDz+vY/cCnl5 h4P4sMJYRnh1Hgtl09CCB3Fcna1xoGldbRjF96naFtPHpDsTj6uLw3ONv/XRZUsVKqgDyL2SYvB 46QX9oR4Z29LSnw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707192422626486 X-GMAIL-MSGID: 1791707192422626486 From: Paolo Abeni After the blamed commit below, the send buffer auto-tuning can happen after that the mptcp_propagate_sndbuf() completes - via the delegated action infrastructure. We must check for write space even after such change or we risk missing the wake-up event. Fixes: 8005184fd1ca ("mptcp: refactor sndbuf auto-tuning") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 631a7f445f34..07f6242afc1a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -790,6 +790,16 @@ static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk) READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt); } +static inline void mptcp_write_space(struct sock *sk) +{ + if (sk_stream_is_writeable(sk)) { + /* pairs with memory barrier in mptcp_poll */ + smp_mb(); + if (test_and_clear_bit(MPTCP_NOSPACE, &mptcp_sk(sk)->flags)) + sk_stream_write_space(sk); + } +} + static inline void __mptcp_sync_sndbuf(struct sock *sk) { struct mptcp_subflow_context *subflow; @@ -808,6 +818,7 @@ static inline void __mptcp_sync_sndbuf(struct sock *sk) /* the msk max wmem limit is * tcp wmem[2] */ WRITE_ONCE(sk->sk_sndbuf, new_sndbuf); + mptcp_write_space(sk); } /* The called held both the msk socket and the subflow socket locks, @@ -838,16 +849,6 @@ static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) local_bh_enable(); } -static inline void mptcp_write_space(struct sock *sk) -{ - if (sk_stream_is_writeable(sk)) { - /* pairs with memory barrier in mptcp_poll */ - smp_mb(); - if (test_and_clear_bit(MPTCP_NOSPACE, &mptcp_sk(sk)->flags)) - sk_stream_write_space(sk); - } -} - void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags); #define MPTCP_TOKEN_MAX_RETRIES 4 From patchwork Fri Feb 23 16:14:17 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: 205490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp688417dyb; Fri, 23 Feb 2024 08:17:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdvimfZ1Mv8NegiQ0E+t/sB2ewsFIB4iGPYkEIbFUfPv/6EyQfdO769QwITMSr2GVGAnnVgnsDaJ1oFyskF3WMkSNl/g== X-Google-Smtp-Source: AGHT+IGVTVw4RyrbYu9hi52isXnI5ZZ2Zu8O9QHjXr5IBI87l5geNYvIeR2ZFGGSnW3sVGkkAFtD X-Received: by 2002:a05:620a:1d98:b0:787:9e64:d8e3 with SMTP id pj24-20020a05620a1d9800b007879e64d8e3mr267354qkn.75.1708705076087; Fri, 23 Feb 2024 08:17:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705076; cv=pass; d=google.com; s=arc-20160816; b=UCz5o0TbpByWl/UJ1gQ+EGyzHs3V/7RvnoL9S+XjQnE150jcJDNPHVZJE1KWGnGmtv v0znCaCKxbi4f8fvMAgvPILe7wnoGKpgLwuM9QrdMBAJhkSN8TuY17pkycZhuukjRu1l RjiSjnc0q8aR/3QtFZryUawLGYGC/Glq7CJtQhvFY2HppCF8dpfJ3YNY7dERtCzwW3Ve iWZAD2mNd1lpIEPctPGumcecNEzNXPd+QSxEx8N4nDGjl+hk4H9YZzuzWMgVKzJ0w3+0 LuxantffRGdpdp2jyhU3cMxQ17jIDXqPJK1uKLjV84ogg5ciJr8o3g8LNgkUakLRM6LN +VBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=HsZfQI//PXRt3s4MJd7a2XZGSEtyuG7EE2v9J+DFkCU=; fh=tHeEkhyqHGk1LGK1GVLG9H+11EfdbPltOPR7aCZnwg0=; b=S9SAwW+K9PY652entdQx0HIzeDif7bAcv+O68B5hH71RFswWJ/VIit12yQ72ofNRUj m2O191wLflhBkxHlRL/pWFusasiR/IJU8xde9/cv+jOXGQz/K2lNMGqQC91E/TmV3z86 sk7Il90dmXME6xf9kfV2E87EjMx5KHu2L2zlTRezK9lH1OCQT5jWjjjLPWu3irP3hPF9 U2KMbR8kGiyY62EAh7xwqRtfqa1A7dwzQ+5Gf5DxSrfbaxuej2rJFWcX/3M7xEi9a+Zn F7sySpv5OuiaFC97FpaQ3X3dJR9i5cYP4AaCx6m+jb0qfmJzrHzu1AKrBpM1Sk1mEVxS sglg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="L+m0Q/oS"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78696-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78696-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w6-20020a05620a444600b00787b873b66dsi859074qkp.235.2024.02.23.08.17.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:17:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78696-ouuuleilei=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="L+m0Q/oS"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78696-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78696-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DBE431C215EF for ; Fri, 23 Feb 2024 16:17:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AC3C126F3E; Fri, 23 Feb 2024 16:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L+m0Q/oS" 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 7A26B1272CD; Fri, 23 Feb 2024 16:15:06 +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=1708704906; cv=none; b=HvNsAlywj4bpsPRhLNtKseQrYlFXYEaBCAPqx+upHWlwiee798Do+pW9xRsZXJrhvUyzh1Vl1Sd3b4M9JfJhYJ2EVfQHHLy1gWcy8ApZLFlEZWsDQjb7eyVpRjcnbR1h3dM5yOwPcXv8gXkfPmujV4CLmJj7RyzqkrTKnxH1Je4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704906; c=relaxed/simple; bh=b+ZN3PITa9kkg8zOC0cUDaJjwPVoLTyK2mnUW7RNJsA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oFMPqaA0KWkz7nIeMfwXmlVsZ7qeBBIaO3v5rZbU4MsgHTHUwzCA20QyBlK9Ya2ZjUxNYt9CE1DCpce4f83FAK0pbj3KxwPcgT4DNetxFjpUTTNypUwy3Eq7XV1XHzUILFmMHwPxtI/YRLJSXAVU6nHRX8nDU7meyKF9b3Ug/v8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L+m0Q/oS; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4496EC433F1; Fri, 23 Feb 2024 16:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704905; bh=b+ZN3PITa9kkg8zOC0cUDaJjwPVoLTyK2mnUW7RNJsA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=L+m0Q/oSLKJOkrbYpLsIewuZcckjXTCmKJM8dpHaK64RLuouMelF3H36YDOAxoCi0 m9fMAFIrBGDZ6DqONllUBxRVknx/DMzLMjLcta7//XTXjgdOfqgZH0IGSLzFJWFSUs EgfTFmPVJ8Z7yfzsvvds1pEvR3eu0WdPDnbpBANksyl531f+svBfZ9wLMgdTWz+WrH PJHsozMbxAJ2bD86baEezNgLiy40ll+btaWcn6I9qc+JgIdqR4PgXqjHsot9cdIbgq wvrjzwJ32m6sY0DyFU6Ia4gICSqDzzDkIf+qzBhnIzq5ZKYWBDpKMdE8uWvPIuLlnD A8CAClnzb1FPA== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:17 +0100 Subject: [PATCH net 07/10] selftests: mptcp: join: add ss mptcp support check Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-7-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1126; i=matttbe@kernel.org; h=from:subject:message-id; bh=KLB3MMq4NcEI7Evk8y2hay/amTn6SC9Wks/c0APaicY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqp99SXmBP+BCtfm0cIfwhmR9owsF54p2/3 jHTQHHFQBGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c6GiD/9ODQHMUmkHjQr/jjXIX7p5secWLqfKIUtaHgmsfuT30Z11zHFyfIEDJTzT6l1/ptn3CEn LRKZUnkDVYl4KaW9en5CKsvHDfgbyO5vIr62J4FaIHuCnWLVGeH4hH4rQj0A4k0TxVtGmAUqW0n 2h3eW+addcNa3jREiKgxAXPguF16zr8hlrED92Oi7/oYwsjJYU9Zj5YRNXOWhchgp91qOjcpJ+I wfAuYKSQi47h0a30vDVWmzLjqhUR3mOtGVkLHBiMYl74mCeygJfDlSiEsW/CTVFr1Zkv12nRoSb 1thkPABxV/1tFOngs85lQXZjzcnrH6y7YhF8PPMY6QkW99pGuBUwTfMN6qgYh9lyBCaappGcpTf pA9102wHwZfIOh50Pxw6pzN31ZsbY/sOtEs+2oYNXixpx/8MlNpl7xIU/OCxPKhS0i6M+gFi80+ xwrHjMIubaWaKF0U/2HtyWjHOgup91/faSk+UaC6f2cNx0ZDoiaSsw9MnGrAlF+89kFV3EyQT4u 7U9gnk4EegqZfnrtScP40gwPHtW4kNh+Ix4hq8PqYpKXg8jC/AUX3o6TnDZ29p6XSWsK+SfdIqH wKxOuyF1rDWDNAzFpRaO4yYlPPghdrZ05DzDhBptFm7UPX4Ay2HYxUPwWqsS7wzHB4HDgCMgKgn odeHoGcCPbjPRuQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707133984071079 X-GMAIL-MSGID: 1791707133984071079 From: Geliang Tang Commands 'ss -M' are used in script mptcp_join.sh to display only MPTCP sockets. So it must be checked if ss tool supports MPTCP in this script. Fixes: e274f7154008 ("selftests: mptcp: add subflow limits test-cases") Cc: stable@vger.kernel.org Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index e68b1bc2c2e4..e4581b0dfb96 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -161,6 +161,11 @@ check_tools() exit $ksft_skip fi + if ! ss -h | grep -q MPTCP; then + echo "SKIP: ss tool does not support MPTCP" + exit $ksft_skip + fi + # Use the legacy version if available to support old kernel versions if iptables-legacy -V &> /dev/null; then iptables="iptables-legacy" From patchwork Fri Feb 23 16:14:18 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: 205493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp688816dyb; Fri, 23 Feb 2024 08:18:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV4AwBXglG5UyBbgXAq8C4LfMSTSq4MUwZWVHDtx/c9Fj8YqubZeHRDoORLKh3sgSY3LJRj3uBvz3OyWkQdyy/ikBUw2w== X-Google-Smtp-Source: AGHT+IHdc1zgsO5JICh0kYIdLFi8HMWSqrirI5fhrOS/FbyQVxAUaPqaWBMzeptzZOFyd7ULe16r X-Received: by 2002:a05:620a:4406:b0:785:53cc:ba81 with SMTP id v6-20020a05620a440600b0078553ccba81mr354224qkp.42.1708705110801; Fri, 23 Feb 2024 08:18:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705110; cv=pass; d=google.com; s=arc-20160816; b=DYAWMDHME78z0/NJouVIUhskHBRCqD2Qzk1igYWbF/RcOmXg7n90JpeLaj7ubIuEqd 01opiagmgtKch72+jQ3w4OfymO8TIgd8en1hHUvHttbGuXd7vzxH+IKBHkSWsgcldT0q oE6sjw2naymp0DakwZzWQ7r+d+SEo6EAOTQXMFOVvvQMsomo2K5456LqMk2DXOiZJwu3 tk0uHWbUh/zOetAkUirmEsGpu8IWuwnrsEEbGB8B4syS/gUbCOd/Z5FaiLqYyqex7DA9 6eVGrrJvyIE5iDDYWMbihRnOffg0LzY+xOP6sRL/mxbEuAH5MNcoq5HFD5x2uhuSEtO4 C9FQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=Myodml+k40yWlRVd2NWZ+fCk1wDv7pp1tMR6mr4Vd7U=; fh=ev5/Y6zFxOWPvgeEJ96WLN00KJoBTiDRf8rr6pXobP0=; b=yBTsH+hJRwDgkA6HxhiS7qlldgGCvNr+YgSXRlzZapMFl5ZzUefX9XTXFNXOEILk5C 2TdSd7pIwOpgtKNf66EMW+oyFjrHgGcK9s8f4oeM+HSylbw30ZICJBJQKZe22kSy9r+C EOPEV8sHuJBUw/ePaOASBBjhkaA2F9NKww+nlnnH/fh9vz0aej/grQClYGZZkq0acaDX 7UraxfQgOdHSQELcgA4gQZSagD5XQj2H1iUpEOpI7W+FR+Ys720Cjmd9l5nfvP3o9POO tP0YoWUpXqzfiY0R8g/e6OqoAUueFCZVLULhN0q+kIjRdcEuVU9zCDdpp/xioDyWxwAX 4Mng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nL6RHuJw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78697-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78697-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id oo19-20020a05620a531300b007873fe9f4d2si15579281qkn.259.2024.02.23.08.18.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:18:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78697-ouuuleilei=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=nL6RHuJw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78697-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78697-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 878341C2118D for ; Fri, 23 Feb 2024 16:18:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5594013B7B0; Fri, 23 Feb 2024 16:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nL6RHuJw" 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 50A2F1272D9; Fri, 23 Feb 2024 16:15:10 +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=1708704911; cv=none; b=N185gf6tO37BDqca9ofe4HvDYKZd9DjEyn1foON4agBS7wSuR9SJ0dPCTobsXSydQPVyWbzlQcstY0VEWNE5q2pv5x4JBBG7bqv+/ueiDr1BzFmOzwafHMhUV43yr32wfWaTEFHJ5X6NQHms6X7a/m2bMHtMiUaSB4NLOnawdFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704911; c=relaxed/simple; bh=UOmb8QUKpfB4+WjxyRhNnD+CWLS+80nZ+BSmHaLlkTw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N6EWjMwqyD8XxykJ9mXPQrdqICwXCkMjOpD5yTfYPz+L72L7WN+TviPRYWPJq8zI9Rhf5g/VIFZCaoVDLkPEqo64ojAeRgputSGlVzTaL+ZmyQc5JnHGJd+jmcag6BsBFTn256R4PZtGb0zqVO2fIdrGxNwVaWJsQpbLxVLOgYg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nL6RHuJw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42488C43390; Fri, 23 Feb 2024 16:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704909; bh=UOmb8QUKpfB4+WjxyRhNnD+CWLS+80nZ+BSmHaLlkTw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nL6RHuJwX6P4sv9LOiFdft0R4K907aiXbhvYbHDG7+ko+FuVWxFo/VYIyXmgnrJsE jBSvrAFJgcyUw/7LMGlZZV6eB5w9bu9F3EkD4cEqmNOF5qE8oeyY9WDSmjhFtzpNPz jQ5MwIhGnOCsoxY2wAc59alMd7rooFP67+PhqjyWszD8YWQo5oSJsLmeaJaELfcPmK K7f/FS2xRPO93UH//GQO+RR3ybEW/3ztQhqeUVuk4hPrLd+IJv8B06bquM6EC1Mpbt AhfXHZBhzz5IKvWsMLFZr/XugZdDmZ168c6TwAHz8EOLQLs09obz4ayDeppu78lhqq FhZrfTFR5dFeQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:18 +0100 Subject: [PATCH net 08/10] mptcp: fix double-free on socket dismantle Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-8-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , Davide Caratti , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6954; i=matttbe@kernel.org; h=from:subject:message-id; bh=g2NHIj59A7epffNx/pwc/bVVEml4bfYZeG26nwfmrmc=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqCRQrauV3D9skqzFRuo9n0hpI1aeEHyQo+ f3gjagRL8yJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c0FFD/48f2Iv5jX8iHk2IvEhVok3sehVXDBlVamGz89DgI0Lr74tb93HhoYqWdPRwqEByPrZlGF Y9wxH6llNoy60ZSY/LwBTvXQb5mc+LBoI9w4xOOIM3eiUCNKsSBGK3rjKPrAlv77hoAlbylodBf VCH6h/FzZcKCHmJmmYE2q+VmO7kuAdjwFUeWCWXfQDQvE4YRCNwOjTprhCU5a8Hgxoo/nUpBg4j ceyW6lqv2z/KOogyyxrUBThcjWyehP7zlk8fm9zPZE6838S+Wu8TPIzR9PUV3J5dM/7hEby4IKL LuuCXo8kHlmDKq+77RsQf15gzC46IFdxSJYNyxbN5koZ35yRCburXiSY11/WoimyOtxmfecIMeU jQsQXTjXUfuAz4QbSMF8nJvwVGYhHMbLNvBpYOT7O3LFY5pePaOMwjaw7PObDR6gjtw/EFLRII3 lW3iA2sH3suKCGnF7iyyWD9mwNj0x5U1RVadYxM15do/cciVKF2QPkpD8K3eBgZNKLVH7sTuVMc 3Ui/Zm6gLpURKGI2wbAu1gVXifmOI4K+Ry2Ig076B9/Aa4iS1H3EhNHAZePZzBtq/1TCyTRLDOa ZMh1syXjmzRnuuNcJBKpXnswyEgf7cjzIktgXMG4G1Lr2p7jGRKYeDVSDR/+tqTOkp8fMqz+RdD u/XMlexdZIiNulA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707170290537668 X-GMAIL-MSGID: 1791707170290537668 From: Davide Caratti when MPTCP server accepts an incoming connection, it clones its listener socket. However, the pointer to 'inet_opt' for the new socket has the same value as the original one: as a consequence, on program exit it's possible to observe the following splat: BUG: KASAN: double-free in inet_sock_destruct+0x54f/0x8b0 Free of addr ffff888485950880 by task swapper/25/0 CPU: 25 PID: 0 Comm: swapper/25 Kdump: loaded Not tainted 6.8.0-rc1+ #609 Hardware name: Supermicro SYS-6027R-72RF/X9DRH-7TF/7F/iTF/iF, BIOS 3.0 07/26/2013 Call Trace: dump_stack_lvl+0x32/0x50 print_report+0xca/0x620 kasan_report_invalid_free+0x64/0x90 __kasan_slab_free+0x1aa/0x1f0 kfree+0xed/0x2e0 inet_sock_destruct+0x54f/0x8b0 __sk_destruct+0x48/0x5b0 rcu_do_batch+0x34e/0xd90 rcu_core+0x559/0xac0 __do_softirq+0x183/0x5a4 irq_exit_rcu+0x12d/0x170 sysvec_apic_timer_interrupt+0x6b/0x80 asm_sysvec_apic_timer_interrupt+0x16/0x20 RIP: 0010:cpuidle_enter_state+0x175/0x300 Code: 30 00 0f 84 1f 01 00 00 83 e8 01 83 f8 ff 75 e5 48 83 c4 18 44 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc fb 45 85 ed <0f> 89 60 ff ff ff 48 c1 e5 06 48 c7 43 18 00 00 00 00 48 83 44 2b RSP: 0018:ffff888481cf7d90 EFLAGS: 00000202 RAX: 0000000000000000 RBX: ffff88887facddc8 RCX: 0000000000000000 RDX: 1ffff1110ff588b1 RSI: 0000000000000019 RDI: ffff88887fac4588 RBP: 0000000000000004 R08: 0000000000000002 R09: 0000000000043080 R10: 0009b02ea273363f R11: ffff88887fabf42b R12: ffffffff932592e0 R13: 0000000000000004 R14: 0000000000000000 R15: 00000022c880ec80 cpuidle_enter+0x4a/0xa0 do_idle+0x310/0x410 cpu_startup_entry+0x51/0x60 start_secondary+0x211/0x270 secondary_startup_64_no_verify+0x184/0x18b Allocated by task 6853: kasan_save_stack+0x1c/0x40 kasan_save_track+0x10/0x30 __kasan_kmalloc+0xa6/0xb0 __kmalloc+0x1eb/0x450 cipso_v4_sock_setattr+0x96/0x360 netlbl_sock_setattr+0x132/0x1f0 selinux_netlbl_socket_post_create+0x6c/0x110 selinux_socket_post_create+0x37b/0x7f0 security_socket_post_create+0x63/0xb0 __sock_create+0x305/0x450 __sys_socket_create.part.23+0xbd/0x130 __sys_socket+0x37/0xb0 __x64_sys_socket+0x6f/0xb0 do_syscall_64+0x83/0x160 entry_SYSCALL_64_after_hwframe+0x6e/0x76 Freed by task 6858: kasan_save_stack+0x1c/0x40 kasan_save_track+0x10/0x30 kasan_save_free_info+0x3b/0x60 __kasan_slab_free+0x12c/0x1f0 kfree+0xed/0x2e0 inet_sock_destruct+0x54f/0x8b0 __sk_destruct+0x48/0x5b0 subflow_ulp_release+0x1f0/0x250 tcp_cleanup_ulp+0x6e/0x110 tcp_v4_destroy_sock+0x5a/0x3a0 inet_csk_destroy_sock+0x135/0x390 tcp_fin+0x416/0x5c0 tcp_data_queue+0x1bc8/0x4310 tcp_rcv_state_process+0x15a3/0x47b0 tcp_v4_do_rcv+0x2c1/0x990 tcp_v4_rcv+0x41fb/0x5ed0 ip_protocol_deliver_rcu+0x6d/0x9f0 ip_local_deliver_finish+0x278/0x360 ip_local_deliver+0x182/0x2c0 ip_rcv+0xb5/0x1c0 __netif_receive_skb_one_core+0x16e/0x1b0 process_backlog+0x1e3/0x650 __napi_poll+0xa6/0x500 net_rx_action+0x740/0xbb0 __do_softirq+0x183/0x5a4 The buggy address belongs to the object at ffff888485950880 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff888485950880, ffff8884859508c0) The buggy address belongs to the physical page: page:0000000056d1e95e refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888485950700 pfn:0x485950 flags: 0x57ffffc0000800(slab|node=1|zone=2|lastcpupid=0x1fffff) page_type: 0xffffffff() raw: 0057ffffc0000800 ffff88810004c640 ffffea00121b8ac0 dead000000000006 raw: ffff888485950700 0000000000200019 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888485950780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888485950800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff888485950880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff888485950900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888485950980: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc Something similar (a refcount underflow) happens with CALIPSO/IPv6. Fix this by duplicating IP / IPv6 options after clone, so that ip{,6}_sock_destruct() doesn't end up freeing the same memory area twice. Fixes: cf7da0d66cc1 ("mptcp: Create SUBFLOW socket for incoming connections") Cc: stable@vger.kernel.org Signed-off-by: Davide Caratti Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 2c8f931c6d5b..7833a49f6214 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3178,8 +3178,50 @@ static struct ipv6_pinfo *mptcp_inet6_sk(const struct sock *sk) return (struct ipv6_pinfo *)(((u8 *)sk) + offset); } + +static void mptcp_copy_ip6_options(struct sock *newsk, const struct sock *sk) +{ + const struct ipv6_pinfo *np = inet6_sk(sk); + struct ipv6_txoptions *opt; + struct ipv6_pinfo *newnp; + + newnp = inet6_sk(newsk); + + rcu_read_lock(); + opt = rcu_dereference(np->opt); + if (opt) { + opt = ipv6_dup_options(newsk, opt); + if (!opt) + net_warn_ratelimited("%s: Failed to copy ip6 options\n", __func__); + } + RCU_INIT_POINTER(newnp->opt, opt); + rcu_read_unlock(); +} #endif +static void mptcp_copy_ip_options(struct sock *newsk, const struct sock *sk) +{ + struct ip_options_rcu *inet_opt, *newopt = NULL; + const struct inet_sock *inet = inet_sk(sk); + struct inet_sock *newinet; + + newinet = inet_sk(newsk); + + rcu_read_lock(); + inet_opt = rcu_dereference(inet->inet_opt); + if (inet_opt) { + newopt = sock_kmalloc(newsk, sizeof(*inet_opt) + + inet_opt->opt.optlen, GFP_ATOMIC); + if (newopt) + memcpy(newopt, inet_opt, sizeof(*inet_opt) + + inet_opt->opt.optlen); + else + net_warn_ratelimited("%s: Failed to copy ip options\n", __func__); + } + RCU_INIT_POINTER(newinet->inet_opt, newopt); + rcu_read_unlock(); +} + struct sock *mptcp_sk_clone_init(const struct sock *sk, const struct mptcp_options_received *mp_opt, struct sock *ssk, @@ -3200,6 +3242,13 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk, __mptcp_init_sock(nsk); +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + if (nsk->sk_family == AF_INET6) + mptcp_copy_ip6_options(nsk, sk); + else +#endif + mptcp_copy_ip_options(nsk, sk); + msk = mptcp_sk(nsk); msk->local_key = subflow_req->local_key; msk->token = subflow_req->token; From patchwork Fri Feb 23 16:14:19 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: 205496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp688985dyb; Fri, 23 Feb 2024 08:18:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUww+OpofsSzNI4CAyllBn4l7f+Qd3OflXVk4ycvQSqEj0mEM7QfdmiYIZ6npB1vGfNkuDCiSp1mge8orLJfIr9oAdEPw== X-Google-Smtp-Source: AGHT+IFamxoS1beM4R2KEKVvz2SYEQjE0NMxUCpD1GhuM/k093oUaaDO7YgqaswnY7xqYO3C0XYr X-Received: by 2002:a05:620a:4494:b0:787:2e2b:a78f with SMTP id x20-20020a05620a449400b007872e2ba78fmr373904qkp.33.1708705127180; Fri, 23 Feb 2024 08:18:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708705127; cv=pass; d=google.com; s=arc-20160816; b=bYUcR8HNRbQfgsSZuaNzpLfnqpM/9Grfdxa9Wm3fD1QfO5hleN4V+WCjEiwI3PaR/V kXxVHLTB+lzxoKE54eMQlJbdG8E1FtN1ZUQseCkpCdCIVG533kcMqGv/D26Ud8t0jhoV TyhlGWzDVkR5q8yMsgjd/jJm1+g5OMd+MCchk4vY6QOLanQ+nLCnoGulCSbVpEdt10hs 0wgfByvNc+YBbbVVhcdjEukbtOmTR6kAYZXW7e69agZ18caeu2ERkyetMxeF3yALUPl9 9q9+rRMgQe+Cz/MFnOmP51dV6Ak4+uZLq6kAPMeHdwZyFbA8ICIH38TF6oymDzxwhR3Q HjDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=qpgW771wn4k5AuQUG6PqizsUz2AeiS0v594Q6RdPtF4=; fh=ToGV+xC+odn978/seKM04ODnJt/4Ke0GvS9hN0caSHU=; b=BUAS71p9xdbuHgdERlsJND0n5aLK7MohnSvuW5YWdWCiGPs4R9DAel3OzKQyVlzO4l AvCArSDVOcjQ+uxFWrtRere74QC96Yy5LnJqk+K+3uhNIV0JWUxAcidKjZN0CFY16KJE XgBxao7XDGZA8pT5OBeDgWsY6mjtOjHeI0nFF76Fb8ATEtiQrY1+Bf2PZK8EToNz39kg 36kTb0ZPKbdWh/8Xomisi5fuSkh1jrI6DIz/0eVtqDqZ+qtNzpfwOb5lcABNINUjfbeZ M+eVEb4tZ8N/Jxa3pWnU67mK0uy05f4mKgWFhKlotiCdteIrVGiRHVrVmk4w7GeAtIG1 boHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uMP9Zs9F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78698-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b7-20020ac85407000000b0042e4f8b40e5si3273321qtq.575.2024.02.23.08.18.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:18:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78698-ouuuleilei=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=uMP9Zs9F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78698-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E63441C20D03 for ; Fri, 23 Feb 2024 16:18:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E95213BAEA; Fri, 23 Feb 2024 16:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uMP9Zs9F" 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 B3E9313A887; Fri, 23 Feb 2024 16:15:13 +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=1708704913; cv=none; b=oawnn0iozqrwu02CujdlfrCgnirEdX9vglqm6WYi6eyYaSOZ8khV42OhcX1gVWxifE5ki/OiuaN88tXnC0Lyoh61gPfjiNHMydz1sfcRvEDW/uGc/aAqVxfd9J31mNN+edmyD542o4mvD9J8xl6T0lNmSHLcVASy1tFSL+hrzls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704913; c=relaxed/simple; bh=7TtWjndsxVYffCALwoOeo7w2xmYQpzPb4cckMSedr8o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P9kJKYf9J58//ZstaPzrQ/f3CIDpNtGpQ0UtFvHQiC8QM0W8/KNRKBtQJTn/fFTASMO0SOVXfIe2Q07qYelaQkODyezqz76uFCGMGR3XT9EBvkGnL0kErzmSSKbARSxUoVkxRehrf7nPL2rnhZT1ZCb03S6XtHXDp8Kzw6MS+iE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uMP9Zs9F; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43753C433C7; Fri, 23 Feb 2024 16:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704913; bh=7TtWjndsxVYffCALwoOeo7w2xmYQpzPb4cckMSedr8o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uMP9Zs9FvAfs8yXXna/ZtizY9EHKjdcpQeCD7uKP4MR3vD01xGG8ZQosUT1+hw+xf oA1W70K/jcKg82oh9UekJDpVQAWhGHi+roXddDAeu38K+SimnnLwkWwSOoQmROPqiJ zzMEs/0R8snoUE0zySjABHzZobcTSdkYTkRETuiEVwQiiHFt42UQ2Ggfh13T/+XNZ0 utgq/pGCiIWLJlqpNrWC7XvU2kLZS5Rp49EYex1a+w530Bx/2gS7Bki4TIc3lavPzp uhvoM5UrGe4LzGCOlyIih5+4AehIuzcjq25othCKufNLvfTx2LWPTFmdf7Y3QEyIvA pwH6tmithjCOw== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:19 +0100 Subject: [PATCH net 09/10] mptcp: fix possible deadlock in subflow diag Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-9-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5011; i=matttbe@kernel.org; h=from:subject:message-id; bh=r5yS2aqxy/UFqDVBdC2SzLwUgEbcbOAGxz23X5YQglQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRqJQlYEbverqjk/Wt3czNkvGndu41GkjAVk Ipdmg1TyUyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c+qAD/9eH6iHyK1RwTYjxr/tAoH+SjQQWyyiQhjuZRa5eOHb/Wzp9QHInrYQhEAcrT2McZ/qBia ngOUSBp9kzlnuljowjUa2wDCVqhW+RE11BWvUqSHvvtONFt9HBxzyQ2RLSHLkFB/2ZMPqbUca8L 2Oot9QjYxQQrCUex4NzQkNiQNlleaTChQpPDUmU6AwaVeVvf1C9d7w9rQxA1rV2BSHNa4C2jsgu JXZY+424zLdFx3MnM0cW6IhfkrK8D+zquFuViCGyh3Tzkp7s3UlnumO48JCcucLouAyb3o2a2e4 AWCzqLcxCoeten7eVvogMlPV+wFQwnEC2S2LbKgD91eXBQot4KqoBcvXm2W5bwO6ScSYfT2HJ5q bihP/eSvTpdtNN2XlqarlQqC1ccgxKOm7x4LiXwm4BPnNgOBOWtKVFKrXumFB7bcgt8DEfJ4GfZ osl8rwV73RgwfLCOJX+Iunv2dYGwXKnbNEB9paFifPw2SsqeXwdwDDl23h5HDb6PlDJ0vLvKSqW 6tQ+r3siPX5XS7MTyTS0mlYNd3pw6v/BoN5q76wIUJbJtdO7w7iUfGUD/LtCwERJIvZs0edULIu hM0WLZ4gVlGgw2YyESGr+HphdIbVLsk/TKEtc4oRBXRajGJf8rapMqw4BaVQRrnM+lFzJIdRSBB 4lKYfuJ0BLEbuMw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791707187484444012 X-GMAIL-MSGID: 1791707187484444012 From: Paolo Abeni Syzbot and Eric reported a lockdep splat in the subflow diag: WARNING: possible circular locking dependency detected 6.8.0-rc4-syzkaller-00212-g40b9385dd8e6 #0 Not tainted syz-executor.2/24141 is trying to acquire lock: ffff888045870130 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at: tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline] ffff888045870130 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at: tcp_diag_get_aux+0x738/0x830 net/ipv4/tcp_diag.c:137 but task is already holding lock: ffffc9000135e488 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] ffffc9000135e488 (&h->lhash2[i].lock){+.+.}-{2:2}, at: inet_diag_dump_icsk+0x39f/0x1f80 net/ipv4/inet_diag.c:1038 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&h->lhash2[i].lock){+.+.}-{2:2}: lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] __inet_hash+0x335/0xbe0 net/ipv4/inet_hashtables.c:743 inet_csk_listen_start+0x23a/0x320 net/ipv4/inet_connection_sock.c:1261 __inet_listen_sk+0x2a2/0x770 net/ipv4/af_inet.c:217 inet_listen+0xa3/0x110 net/ipv4/af_inet.c:239 rds_tcp_listen_init+0x3fd/0x5a0 net/rds/tcp_listen.c:316 rds_tcp_init_net+0x141/0x320 net/rds/tcp.c:577 ops_init+0x352/0x610 net/core/net_namespace.c:136 __register_pernet_operations net/core/net_namespace.c:1214 [inline] register_pernet_operations+0x2cb/0x660 net/core/net_namespace.c:1283 register_pernet_device+0x33/0x80 net/core/net_namespace.c:1370 rds_tcp_init+0x62/0xd0 net/rds/tcp.c:735 do_one_initcall+0x238/0x830 init/main.c:1236 do_initcall_level+0x157/0x210 init/main.c:1298 do_initcalls+0x3f/0x80 init/main.c:1314 kernel_init_freeable+0x42f/0x5d0 init/main.c:1551 kernel_init+0x1d/0x2a0 init/main.c:1441 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242 -> #0 (k-sk_lock-AF_INET6){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18ca/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 lock_sock_fast include/net/sock.h:1723 [inline] subflow_get_info+0x166/0xd20 net/mptcp/diag.c:28 tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline] tcp_diag_get_aux+0x738/0x830 net/ipv4/tcp_diag.c:137 inet_sk_diag_fill+0x10ed/0x1e00 net/ipv4/inet_diag.c:345 inet_diag_dump_icsk+0x55b/0x1f80 net/ipv4/inet_diag.c:1061 __inet_diag_dump+0x211/0x3a0 net/ipv4/inet_diag.c:1263 inet_diag_dump_compat+0x1c1/0x2d0 net/ipv4/inet_diag.c:1371 netlink_dump+0x59b/0xc80 net/netlink/af_netlink.c:2264 __netlink_dump_start+0x5df/0x790 net/netlink/af_netlink.c:2370 netlink_dump_start include/linux/netlink.h:338 [inline] inet_diag_rcv_msg_compat+0x209/0x4c0 net/ipv4/inet_diag.c:1405 sock_diag_rcv_msg+0xe7/0x410 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543 sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline] netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367 netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 As noted by Eric we can break the lock dependency chain avoid dumping any extended info for the mptcp subflow listener: nothing actually useful is presented there. Fixes: b8adb69a7d29 ("mptcp: fix lockless access in subflow ULP diag") Cc: stable@vger.kernel.org Reported-by: Eric Dumazet Closes: https://lore.kernel.org/netdev/CANn89iJ=Oecw6OZDwmSYc9HJKQ_G32uN11L+oUcMu+TOD5Xiaw@mail.gmail.com/ Suggested-by: Eric Dumazet Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/diag.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mptcp/diag.c b/net/mptcp/diag.c index 6ff6f14674aa..7017dd60659d 100644 --- a/net/mptcp/diag.c +++ b/net/mptcp/diag.c @@ -21,6 +21,9 @@ static int subflow_get_info(struct sock *sk, struct sk_buff *skb) bool slow; int err; + if (inet_sk_state_load(sk) == TCP_LISTEN) + return 0; + start = nla_nest_start_noflag(skb, INET_ULP_INFO_MPTCP); if (!start) return -EMSGSIZE; From patchwork Fri Feb 23 16:14:20 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: 205519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp703821dyb; Fri, 23 Feb 2024 08:44:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYv+rxw39ByrbF2Vz4osj5Uq01uvT2sP2RKvnoxygV5KEZfepMEUEXKVZb/QENCVAOQdUuDhnIg/rmisow2PjqzzWLrA== X-Google-Smtp-Source: AGHT+IEm9zYPuD99jLZENtKKRROfbYNZEJSUiY+2QTLDEonzB85TDPFErFrKR/YfwUQRrBPnx8P1 X-Received: by 2002:a17:902:f645:b0:1dc:b64:13cd with SMTP id m5-20020a170902f64500b001dc0b6413cdmr404947plg.27.1708706682597; Fri, 23 Feb 2024 08:44:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708706682; cv=pass; d=google.com; s=arc-20160816; b=llE0u1KroPav+hYVuMAEAViNce2CT9UdJe+S3dazWgzFXmQDvYa+OwHfliEmDArYq6 BGfSYhg5K9NOcIUAqB72WRU66IxuGsuKynjTRKZzcesaWoPbG48z7qBEqxIV3soGkPLR DNWFGMy01iH3A0j7Gl0QsBkv+mG1QIrjy/6NGk1QYUwhhrBtCzczd8oF31AYOsmL3GBe D/zibRzF2z8iVYX/P04W0omhid6gtaaSaLlGx0EEKzWbDiwcW/NC7cn4xVlOz8fkNawm ivYHo5d2MiRPewHoC3IqsGLTtAGdFkNIzYzlbduarCJgJLej6sFqK6gQ4/X/reZ0hipR pHIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=wuW7EOrnPiiYDSq/8OXG7oK7bH3R11GHBVrjr5UGucw=; fh=f6FEuSnAMkhDWDb4ons7NxcM0idmpK1xwHAqAZzgfBg=; b=z7Ae9xogxaNLWmjkE4KSuaIXHldY5F12nhxPMaL8h47drIwfjNtwaiRl+G6ly7qdus 0Qj7O/Ae55AWiZntzMM84bpFoIg/BWipXQK9h9/zfUKADXEEQN2fv+G58McGHtjUhpAt HQYwtFjXSKxH7FYgX+tNrZ+3Te8w3OnfHuzHLA8dllclEv3+fMOA5WOs5MoBXs/C7MRd y00kWZDay/JDrTwpQ/BB4tRaCq00tOzsWqcZrW5BVnXEOSfHYKgF0HXi0AyH6e7UK9VA Uu6EwkmKyvzEjSzXxnY7bnkfO7bCf6twGGfsHFarglII+3DlsZhApggLCnJBqwGFypzM VsSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JBjLStuK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78700-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78700-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d7-20020a170902654700b001db339f4096si11115953pln.395.2024.02.23.08.44.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:44:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78700-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JBjLStuK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78700-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78700-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D507AB27237 for ; Fri, 23 Feb 2024 16:19:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D64313EFEF; Fri, 23 Feb 2024 16:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JBjLStuK" 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 93DCC13DB85; Fri, 23 Feb 2024 16:15: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=1708704917; cv=none; b=Wbm8oUwBQqm7BTW1jbSaya3ePCYa4OwVUDsWv5kar7R/5VExP4wb72s4pZ2wUelg+UwUXrZasKyP0qt82lTetXX/TrUpKAg4tMx39+h185hdGoCebJ6cq31XVPpKWu5gb+bscMgcY53BcR7/7KXIE4XPgjkniQHyS4X5XPW6EDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704917; c=relaxed/simple; bh=ZSGo7VHZyNR7YikLSbNgmp1YKx0wCf2OokDYsGJL+As=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qgv0sSLclLHKuJTtPsgZ+jMGZ1ymmJx5n45LWKB8c+GEODZTRbS7kiUihKHTbV2KXmDrshRKNfRxhcFqq1rzT1/brozeLayGRMtbBS83EEW8nLIzpE8/YhoExCAJ7HQqucrrjKj0EUE81JPBq/pFDaje+oop2DBW9bgVkYKEUdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JBjLStuK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14A43C43609; Fri, 23 Feb 2024 16:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708704917; bh=ZSGo7VHZyNR7YikLSbNgmp1YKx0wCf2OokDYsGJL+As=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JBjLStuKGQ0t48uwI1VrVmLaTDYnoIkrdhjftdozRlGVTAUAgw/hwuczEBCAHnt42 s/7ZzBInK7SOqpN+W+spe9ndugxSgTTgTFcLF2GdTWmIhaegZ/qGReKB08DYSLMcgR o4PVQ0RSpoyENGUayzzKh5g+zccA3yQVpbcUwLLYD1ga/olLjjMPpeAt7YL0yTPGVF 6Ju1u3SfSLPMNK119vSfY9t8Qn3cMfOuVJUUjJyAfsimyUmxBljnYRnwqmhEIyXXol eYRCseyWA+PhfOHGrtbTlq/T5SO2K0j17xZsu9m7CYUUTQdUqb5zUJygsUk88blg3Y L9sDO7i68RI7A== From: "Matthieu Baerts (NGI0)" Date: Fri, 23 Feb 2024 17:14:20 +0100 Subject: [PATCH net 10/10] selftests: mptcp: explicitly trigger the listener diag code-path Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-upstream-net-20240223-misc-fixes-v1-10-162e87e48497@kernel.org> References: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> In-Reply-To: <20240223-upstream-net-20240223-misc-fixes-v1-0-162e87e48497@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal , Kishen Maloor , Shuah Khan , Peter Krystad , Christoph Paasch Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2320; i=matttbe@kernel.org; h=from:subject:message-id; bh=Ne1BFOJ8rufpD6X3EV4YUBWac7B/xdGlwDdg9Uo0pFw=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl2MRq0+MEzZSnwev80cxcGJ5DUjoTnWmkQGn+T ORD5K9o/5KJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZdjEagAKCRD2t4JPQmmg c/eEEACXKB41A5Zk89fIhexgG1iewjTQEovm2Tk0ABOWuYJ3GncWoL7pzYh+pVQk5PlrilDozrM uQIU/48MtEPJ8JPAXZrhB/cTxWlZNJZiY20Zq0q+QWulujauQOBrc2/ZULjVuTVW1TrAlaIwO16 aU3jjo4zmQg6EpG593OoRFcJgmwi77YW9kJ7z4oB0tx2o3nS/6jABZV/dUP+4SnNAQTyIgy3/sz ruCIS7ZYzYDPa7vogidjjQUEgtVQTNB0X8lDbnVdW72scYgBCLsOWWTUgFZ80qgNGJJsPQXBXKL NJchr6yND2BSHCw4Zp4bvcjfzKUk9zUyFwTnyYWmK5AJgn32fMUisvG38rFs5585NFoGhzqu5ty BixA4nIh08HLtcMd34s2Fho7KVN+Lgpxe5Sjr6ly9pfG8W7WQ3P0NB+1DeB0cWIH4j3Y7nA6BsP 7BdaRdIvgn0M1ku5YMdEHlpnyhuv9cC8uJ0iNbD4GweZfn+SFgVfL7b2B335ZfkFCROOQGurj6M s8JmqDeoC/2asXLQNsB5Bgsmd5P3qxrEhyIwqkvn2rFS/Hm+0DdnoLamLoADPkh7cNDIhcsqqgK 0zghC2hXr+jlrNGOBky+8rXgROoYa8x/n1lYs1N2ovGXh2KaR1BbvvfMKjkTarOsFTpbI9ho5av tqfJ2eOQnUWq4lg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791708818431907856 X-GMAIL-MSGID: 1791708818431907856 From: Paolo Abeni The mptcp diag interface already experienced a few locking bugs that lockdep and appropriate coverage have detected in advance. Let's add a test-case triggering the relevant code path, to prevent similar issues in the future. Be careful to cope with very slow environments. Note that we don't need an explicit timeout on the mptcp_connect subprocess to cope with eventual bug/hang-up as the final cleanup terminating the child processes will take care of that. Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Simon Horman --- tools/testing/selftests/net/mptcp/diag.sh | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index 0a58ebb8b04c..f300f4e1eb59 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -20,7 +20,7 @@ flush_pids() ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null - for _ in $(seq 10); do + for _ in $(seq $((timeout_poll * 10))); do [ -z "$(ip netns pids "${ns}")" ] && break sleep 0.1 done @@ -91,6 +91,15 @@ chk_msk_nr() __chk_msk_nr "grep -c token:" "$@" } +chk_listener_nr() +{ + local expected=$1 + local msg="$2" + + __chk_nr "ss -inmlHMON $ns | wc -l" "$expected" "$msg - mptcp" 0 + __chk_nr "ss -inmlHtON $ns | wc -l" "$expected" "$msg - subflows" +} + wait_msk_nr() { local condition="grep -c token:" @@ -289,5 +298,24 @@ flush_pids chk_msk_inuse 0 "many->0" chk_msk_cestab 0 "many->0" +chk_listener_nr 0 "no listener sockets" +NR_SERVERS=100 +for I in $(seq 1 $NR_SERVERS); do + ip netns exec $ns ./mptcp_connect -p $((I + 20001)) \ + -t ${timeout_poll} -l 0.0.0.0 >/dev/null 2>&1 & +done + +for I in $(seq 1 $NR_SERVERS); do + mptcp_lib_wait_local_port_listen $ns $((I + 20001)) +done + +chk_listener_nr $NR_SERVERS "many listener sockets" + +# graceful termination +for I in $(seq 1 $NR_SERVERS); do + echo a | ip netns exec $ns ./mptcp_connect -p $((I + 20001)) 127.0.0.1 >/dev/null 2>&1 & +done +flush_pids + mptcp_lib_result_print_all_tap exit $ret