Path: csiph.com!au2pb.net!feeder.erje.net!2.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod From: Konstantin Khlebnikov Newsgroups: linux.kernel Subject: Re: [BUG] skb corruption and kernel panic at forwarding with fragmentation Date: Wed, 06 Jan 2016 21:20:02 +0100 Message-ID: References: X-Original-To: Cong Wang Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gNa3pu0S2v0gCWKFlZy7ak8jdtYvNWRcOWc8eWOwkQw=; b=QvUpID/zRvVDWGsRaro6mBRLSmLEqbdpx/MipHiKJjLP/qciJFddL7X99zGu1/Okcc a+yYnYv61gs5yLwqhFgzafoEtFZ6nzO8f/7VjcEkOXAtLKKCFUNtq/a7jaCcVkxLPovf oRcm+FwVhgg6kGOta87j5TTn9kx3gMzUPR+TQ2XoyitAFe4eHFdnKzzAlrMSsIMPwJCy 8z0ILl0dUIt4r6wqDbsX2hp2F/YX8sFQFDiuSc4OUMsWDRrUmITNW7KUhfuRg796qkpA XPamG77l8fYMXIPiZAC9kVw3QZwlg/3mKo7OyyVMfl+5GkaVtl2z1GyrWK9BvVmRL7WH 0b/g== MIME-Version: 1.0 X-Received: by 10.25.148.141 with SMTP id w135mr12372242lfd.137.1452111101514; Wed, 06 Jan 2016 12:11:41 -0800 (PST) Content-Type: text/plain; charset=UTF-8 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 30 Organization: linux.* mail to news gateway X-Original-Cc: Linux Kernel Network Developers , David Miller , Eric Dumazet , Linux Kernel Mailing List X-Original-Date: Wed, 6 Jan 2016 23:11:41 +0300 X-Original-Message-ID: X-Original-References: X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1303037 On Wed, Jan 6, 2016 at 10:59 PM, Cong Wang wrote: > On Wed, Jan 6, 2016 at 11:15 AM, Konstantin Khlebnikov wrote: >> Looks like this happens because ip_options_fragment() relies on >> correct ip options length in ip control block in skb. But in >> ip_finish_output_gso() control block in segments is reused by >> skb_gso_segment(). following ip_fragment() sees some garbage. >> >> In my case there was no ip options but length becomes non-zero and >> ip_options_fragment() picked some bytes from payload and decides to >> fill huge range with IPOPT_NOOP (1). One of that ones flipped nr_frags >> in skb_shared_info at the end of data =) >> > > Hmm, it looks like SKB_GSO_CB should be cleared after skb_gso_segment() > since all the gso information should be saved in shared_info after it finishes. > > Does a memset(0) on SKB_GSO_CB after skb_gso_segment() work as well? This will break present logic around ip_options_fragment() - it clears options from second and following fragments. With zeroed cb it will do nothing. ip_options_fragment() can get required information directly from ip header but it also resets fields in IPCB -- probably it should stay valid here and somebody else will use it later. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/