From patchwork Tue Jul 13 12:01:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12373821 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=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 A37EEC07E95 for ; Tue, 13 Jul 2021 12:01:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8028B61166 for ; Tue, 13 Jul 2021 12:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236042AbhGMMEB (ORCPT ); Tue, 13 Jul 2021 08:04:01 -0400 Received: from relay.sw.ru ([185.231.240.75]:54432 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235797AbhGMMEB (ORCPT ); Tue, 13 Jul 2021 08:04:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Date:Message-ID:Subject :From; bh=XdVSeYsWM6gpkohRLdjfHrqyvOYT/lKERJYnjF+csFw=; b=yJ3he1RbKYdlrK/Y8YO rGj7smjCQp2KnyoyEWpCSveyvJhUjsoDrxlNA72QxeHxO+/nqRuZA1poxEwj/LY1I+N72D6ks+GNY YGHNv/FlKvRdunOeDJbbYcGjIe3n3TP9oeTjm9186KoReM/sVRtIKjOKeQY8UsYVVtUAGGIT8bk=; Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1m3H63-003pDM-9n; Tue, 13 Jul 2021 15:01:07 +0300 From: Vasily Averin Subject: [PATCH NET v4 0/1] ipv6: allocate enough headroom in ip6_finish_output2() To: "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , Eric Dumazet Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: Message-ID: <8bad3fda-2f74-75d7-8461-e49a7e6fdbd9@virtuozzo.com> Date: Tue, 13 Jul 2021 15:01:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Recently Syzkaller found one more issue on RHEL7-based OpenVz kernels. During its investigation I've found that upstream is affected too. TEE target send sbk with small headroom into another interface which requires an increased headroom. ipv4 handles this problem in ip_finish_output2() and creates new skb with enough headroom, though ip6_finish_output2() lacks this logic. Suzkaller created C reproducer, it can be found in v1 cover-letter https://lkml.org/lkml/2021/7/7/467 v4 changes: fixed skb_set_owner_w() call: it should set sk on new nskb v3 changes: now I think it's better to separate bugfix itself and creation of new helper. now bugfix does not create new inline function. Unlike from v1 it creates new skb only when it is necessary, i.e. for shared skb only. In case of failure it updates IPSTATS_MIB_OUTDISCARDS counter Patch set with new helper will be sent separately. v2 changes: new helper was created and used in ip6_finish_output2 and in ip6_xmit() small refactoring in changed functions: commonly used dereferences was replaced by variables Vasily Averin (1): ipv6: allocate enough headroom in ip6_finish_output2() net/ipv6/ip6_output.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)