From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 EC247C43331 for ; Mon, 30 Mar 2020 16:13:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C94FF20732 for ; Mon, 30 Mar 2020 16:13:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729999AbgC3QNm (ORCPT ); Mon, 30 Mar 2020 12:13:42 -0400 Received: from Chamillionaire.breakpoint.cc ([193.142.43.52]:55468 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726017AbgC3QNm (ORCPT ); Mon, 30 Mar 2020 12:13:42 -0400 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1jIx2e-000544-RQ; Mon, 30 Mar 2020 18:13:36 +0200 Date: Mon, 30 Mar 2020 18:13:36 +0200 From: Florian Westphal To: Xin Long Cc: Steffen Klassert , network dev , davem , Paolo Abeni , Florian Westphal Subject: Re: [PATCH net] udp: fix a skb extensions leak Message-ID: <20200330161336.GD23604@breakpoint.cc> References: <20200330082929.GG13121@gauss3.secunet.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Xin Long wrote: > On Mon, Mar 30, 2020 at 4:29 PM Steffen Klassert > wrote: > > > > On Thu, Mar 26, 2020 at 05:06:25PM +0800, Xin Long wrote: > > > On udp rx path udp_rcv_segment() may do segment where the frag skbs > > > will get the header copied from the head skb in skb_segment_list() > > > by calling __copy_skb_header(), which could overwrite the frag skbs' > > > extensions by __skb_ext_copy() and cause a leak. > > > > > > This issue was found after loading esp_offload where a sec path ext > > > is set in the skb. > > > > > > On udp tx gso path, it works well as the frag skbs' extensions are > > > not set. So this issue should be fixed on udp's rx path only and > > > release the frag skbs' extensions before going to do segment. > > > > Are you sure that this affects only the RX path? What if such > > a packet is forwarded? Also, I think TCP has the same problem. > You're right, just confirm it exists on the forwarded path. > __copy_skb_header() is also called by skb_segment(), but > I don't have tests to reproduce it on other protocols like TCP. skb_segment() is fine, either nskb is a new allocation or a clone with head state already discarded. > > If a skb in the fraglist has a secpath, it is still valid. > > So maybe instead of dropping it here and assign the one > > from the head skb, we could just keep the secpath. But > > I don't know about other extensions. I've CCed Florian, > > he might know a bit more about other extensions. Also, > > it might be good to check if the extensions of the GRO > > packets are all the same before merging. > > > Not sure if we can improve __copy_skb_header() or add > a new function to copy these members ONLY when nskb's > are not set. I don't see how.