From patchwork Fri Jan 8 12:52:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongseok Yi X-Patchwork-Id: 12006619 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6D0AC433DB for ; Fri, 8 Jan 2021 13:05:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81E5C235FF for ; Fri, 8 Jan 2021 13:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbhAHNFC (ORCPT ); Fri, 8 Jan 2021 08:05:02 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:54091 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726497AbhAHNFB (ORCPT ); Fri, 8 Jan 2021 08:05:01 -0500 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210108130417epoutp02abd36c1ba3e3dcc6b9e738b1b6e588f4~YQ3nYZ3nB2631526315epoutp02R for ; Fri, 8 Jan 2021 13:04:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210108130417epoutp02abd36c1ba3e3dcc6b9e738b1b6e588f4~YQ3nYZ3nB2631526315epoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1610111057; bh=yb1t3lNqbCL3Nqp7DWuL9oagOsemytre08Dx52vmkE4=; h=From:To:Cc:Subject:Date:References:From; b=cp7v9pugOhOBIPyPNmnhuaH3VQHAnLUKW+GAiMDER+2n2ShJOZT+I0yrKjm/SR3/E Gp0eQiS+lIQIK1gj/Mi1uhhPvAaqHfdwQxsKjkojGC7NhLF+smbMAMNDkh3AQwjqH0 Go9bbyZIHisPHtlS4psgI0HKQqKcXBcftZAbXcwc= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210108130416epcas2p315eceb18ed8b6b8d19f939d2cf91f371~YQ3mlcyfs3150431504epcas2p3Z; Fri, 8 Jan 2021 13:04:16 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.187]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4DC3G725SNz4x9Ps; Fri, 8 Jan 2021 13:04:15 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 17.5E.10621.F4858FF5; Fri, 8 Jan 2021 22:04:15 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20210108130414epcas2p3217d7b6ac8a8094c5b3b6c5e52480134~YQ3lDbVzT0173001730epcas2p3D; Fri, 8 Jan 2021 13:04:14 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210108130414epsmtrp19191f67cc9c95c1f0a8815bffec03fdb~YQ3lCmKXG2492724927epsmtrp1l; Fri, 8 Jan 2021 13:04:14 +0000 (GMT) X-AuditID: b6c32a45-337ff7000001297d-91-5ff8584fba62 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 11.23.08745.E4858FF5; Fri, 8 Jan 2021 22:04:14 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210108130414epsmtip136ab199d368afbc5f67768065e310dc9~YQ3kyDt2l1414414144epsmtip1q; Fri, 8 Jan 2021 13:04:14 +0000 (GMT) From: Dongseok Yi To: "David S. Miller" Cc: namkyu78.kim@samsung.com, Dongseok Yi , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , Willem de Bruijn , Steffen Klassert , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net] udp: check sk for UDP GRO fraglist Date: Fri, 8 Jan 2021 21:52:28 +0900 Message-Id: <1610110348-119768-1-git-send-email-dseok.yi@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJKsWRmVeSWpSXmKPExsWy7bCmqa5/xI94g797eS3mnG9hsbgy7Q+j xYVtfawWF9pesVpc3jWHzaLhTjObxbEFYha7O3+wW7zbcoTd4uveLhYHLo8tK28yeSzYVOqx aVUnm0fbtVVMHlt+f2fz6NuyitFjU+sSVo/Pm+QCOKJybDJSE1NSixRS85LzUzLz0m2VvIPj neNNzQwMdQ0tLcyVFPISc1NtlVx8AnTdMnOATlRSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX 2CqlFqTkFBgaFugVJ+YWl+al6yXn51oZGhgYmQJVJuRk7Jo3laWgSbBi5qJTTA2Mk/i6GDk5 JARMJC7euMoGYgsJ7GCU6Pwb2sXIBWR/YpS4sKifFcL5zCjx++dZZpiOxYdvMkEkdjFK7Ju3 lAWi/QejxOu36SA2m4CGxP53L1hBbBEBbYl1B3rAJjELXGCS+Dd7Ldg+YQFrid0T5jN2MXJw sAioStyYmwwS5hVwlfh34zQ7xDI5iZvnOplBeiUE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WQRU JW7MTQYJ8wq4Svy7cZodYoGcxM1zncwTGHkWMDKsYpRMLSjOTc8tNiwwykst1ytOzC0uzUvX S87P3cQIDj0trR2Me1Z90DvEyMTBeIhRgoNZSYTX4tiXeCHelMTKqtSi/Pii0pzU4kOM0hws SuK8F7pOxgsJpCeWpGanphakFsFkmTg4pRqYLqTm7jk7cUruFV6nLzuXWV9uaNzMsX6zbMOR PiPfny5RaRPP1La5bel6tvE957xZBZbffk2qNJ+8f4fuv9TER8E1pnm5/stPK3ME8V9m+Kux Y32WUuv0s8YlV+bk5J+tS65hMY5Ocu0I4TRc5xwuN11K6l7o/Zm6x1Ljis/NXKDPd7arV2Pn /91BTTci/UwmqARx9UyYu3jVWSvWe2GcdZ9m/Fj0uvPxwaNH2KomzNt90JPr41y/aQcVtI8H X9LhcL174+COBd/uJ83dsYXZ/tXNPYVFkfJlvsY7Ds98uPaIwM1SoUlTFTneJa+2Kf+S4bVJ fPs6nhv7FpxhUuY+7WGrcU3yyde6/tBJXefUK5VYijMSDbWYi4oTAQ1dbHasAgAA X-CMS-MailID: 20210108130414epcas2p3217d7b6ac8a8094c5b3b6c5e52480134 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210108130414epcas2p3217d7b6ac8a8094c5b3b6c5e52480134 References: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC It is a workaround patch. UDP/IP header of UDP GROed frag_skbs are not updated even after NAT forwarding. Only the header of head_skb from ip_finish_output_gso -> skb_gso_segment is updated but following frag_skbs are not updated. A call path skb_mac_gso_segment -> inet_gso_segment -> udp4_ufo_fragment -> __udp_gso_segment -> __udp_gso_segment_list does not try to update any UDP/IP header of the segment list. It might make sense because each skb of frag_skbs is converted to a list of regular packets. Header update with checksum calculation may be not needed for UDP GROed frag_skbs. But UDP GRO frag_list is started from udp_gro_receive, we don't know whether the skb will be NAT forwarded at that time. For workaround, try to get sock always when call udp4_gro_receive -> udp_gro_receive to check if the skb is for local. I'm still not sure if UDP GRO frag_list is really designed for local session only. Can kernel support NAT forward for UDP GRO frag_list? What am I missing? Fixes: 9fd1ff5d2ac7 (udp: Support UDP fraglist GRO/GSO.) Signed-off-by: Dongseok Yi --- net/ipv4/udp_offload.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index ff39e94..d476216 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -457,7 +457,7 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, int flush = 1; NAPI_GRO_CB(skb)->is_flist = 0; - if (skb->dev->features & NETIF_F_GRO_FRAGLIST) + if (sk && (skb->dev->features & NETIF_F_GRO_FRAGLIST)) NAPI_GRO_CB(skb)->is_flist = sk ? !udp_sk(sk)->gro_enabled: 1; if ((sk && udp_sk(sk)->gro_enabled) || NAPI_GRO_CB(skb)->is_flist) { @@ -537,8 +537,7 @@ struct sk_buff *udp4_gro_receive(struct list_head *head, struct sk_buff *skb) NAPI_GRO_CB(skb)->is_ipv6 = 0; rcu_read_lock(); - if (static_branch_unlikely(&udp_encap_needed_key)) - sk = udp4_gro_lookup_skb(skb, uh->source, uh->dest); + sk = udp4_gro_lookup_skb(skb, uh->source, uh->dest); pp = udp_gro_receive(head, skb, uh, sk); rcu_read_unlock();