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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS 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 00F99C37122 for ; Tue, 22 Jan 2019 00:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE0BF21721 for ; Tue, 22 Jan 2019 00:36:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=axtens.net header.i=@axtens.net header.b="C7WKwWEE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726115AbfAVAgx (ORCPT ); Mon, 21 Jan 2019 19:36:53 -0500 Received: from mail-pg1-f174.google.com ([209.85.215.174]:41015 "EHLO mail-pg1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbfAVAgx (ORCPT ); Mon, 21 Jan 2019 19:36:53 -0500 Received: by mail-pg1-f174.google.com with SMTP id m1so10184449pgq.8 for ; Mon, 21 Jan 2019 16:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=5chKwInUsbZfAg1UdoN0I0m+oA7ikmjHELvYfchUzi4=; b=C7WKwWEEMZSPd4lZZFHJ5ZLaQKk6BJd+e22x6nRmW+L1y2A4SH6DcrXI7xPHZzAOsK hOYIIy78Sl4jPkERYkxqB9DTFORFMKaLqK/5R+sP54K+wPeg31T8ZD/nEkBLm5qbm5rb 8rexdy/K1+QrsiBsz2tytb+ja/klDtUW2VgUs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=5chKwInUsbZfAg1UdoN0I0m+oA7ikmjHELvYfchUzi4=; b=rmR2ZZI23DGBV6kjpL7aV72KahehTK+96KYkPCFlRz3f0wjlvZRSF3BYZSY8dOqlOY JybYLx2Kmx4Tu08E4U8ppfqvRmNraaVm6cnwOwiHzNvnE1Pi0TswojAOfsu7SQhNfWFw feFFKXhTSU6tVJC0LMDb2GdvVUKbJU+xwRL0ZYwe06qZXojdrvs2Wkw/LztsIrWyj7AV t2OhCj2kqk3qCU9QCcnmTwKsj4DTDsQHw8ulTbWED4ZS7NLQsirFzQqqpp7gvpUaYHoT rTgz1RpNCXSRcMNaJKM40NYVNKAqarD60aDgfXy1s/feeGbPymfenX576Hq9N9Nnz/l0 eRMA== X-Gm-Message-State: AJcUukdZ61KTaChfHHFWWIn4Km8e83T90LO+9ralpw7mlrBiqIkkRTio nLfh+V24lkoWbgqVjXaUnsNhuw== X-Google-Smtp-Source: ALg8bN4cWX1ewffMteRaRfE9FjLRcHMCYBXPm3DIdZ/8uIl/Pp3qOQ/X1UGnw5F3TEL8xw6gGFy5Qw== X-Received: by 2002:a62:d885:: with SMTP id e127mr31426541pfg.197.1548117412167; Mon, 21 Jan 2019 16:36:52 -0800 (PST) Received: from localhost (124-171-166-13.dyn.iinet.net.au. [124.171.166.13]) by smtp.gmail.com with ESMTPSA id v12sm15142031pgg.41.2019.01.21.16.36.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 16:36:51 -0800 (PST) From: Daniel Axtens To: Michael Chan , Netdev , David Miller Subject: Re: Stack sends oversize UDP packet to the driver In-Reply-To: References: Date: Tue, 22 Jan 2019 11:36:47 +1100 Message-ID: <874la1r0io.fsf@linkitivity.dja.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Michael, > I've received a bug report of oversized UDP packets sent to the > bnxt_en driver for transmission. There is no check for illegal length > in the driver and it will send a corrupted BD to the NIC if the > non-TSO length exceeds the maximum MTU supported by the driver. This > ultimately causes the driver to hang. > > Looking a little deeper, it looks like the route of the SKB was > initially to "lo" and therefore no fragmentation was done. And it > looks like the route later got changed to the bnxt_en dev before > transmission. The user was doing multiple VM reboots and the bad > length was happening on the Linux host. > > I can add a length check in the driver to prevent this. But is there > a better way to prevent this in the stack? Thanks. I hit a similar sounding issue on a bnx2x - see commit 8914a595110a6eca69a5e275b323f5d09e18f4f9 In that case, a GSO packet with gso_size too large for the firmware was coming to the bnx2x driver from an ibmveth device via Open vSwitch. I also toyed with a fix in the stack and ended up fixing just the driver. I was hoping to get a generic fix in to the stack afterwards, but didn't get anything finished. Looking back at old branches, it looks like I considered adding MTU validation to validate_xmit_skb, but I never got that upstream. My vague recollection is that I ended up caught by edge cases: GSO_DODGY allows an untrusted source to set gso parameters, so that needed to be validated first - and that was complex and potentially slow, and I just got overtaken by more urgent work. (Note that this was a year ago and was in many ways my introduction to TSO/GSO, so I could be completely wrong.) Anyway, I can send you my partial work if it would be helpful. Regards, Daniel