Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4065233rwj; Tue, 20 Dec 2022 05:47:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXtHQhx2D9OYgwz1YbzlsYB+UoxWzx5nWBSLzEdfWKdbFxVQw8f8EHNFVFTaTfxJXERZi8jv X-Received: by 2002:a17:906:c2c4:b0:837:3ddb:7e97 with SMTP id ch4-20020a170906c2c400b008373ddb7e97mr2347598ejb.61.1671544023684; Tue, 20 Dec 2022 05:47:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671544023; cv=none; d=google.com; s=arc-20160816; b=Kqv4waYZvFY3hkrx09rO79WDWTAVsPd2FPOFwAkrTwySPi4Mzastm2nP7SqDOPtjpg uhs6Ch+NoLZNUIgvTWW1yVP6tEbkS/ksqEVhUdalzwObJu2GWjXMHyxq0XrbkXOGtPIU F2uVEGuSfmbs+sXgzRenux9Z736OskQdo/ffhN1qN8swLFtI9kCFA+177zITVVTlMLIE XwPJ9I20lZi6mnShTE1QbhJmJQ2AV54NpJyoeq/3r6RdFGFzooVHkJ+Vs9BUZ3TtJG/O X1GIsB2bV+At2kCsiE8X1JeDXPF9F/jKQ7gCVuZoPXe8myZ/OhBIoxGwKnDV2DCE91Vp AcNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=j4EnR1Q2u0KKc+AisGhIqSegw9gJYBOb4g7u1uoRDKQ=; b=OKgbmmDYNTKnh7vrJA/h6GDpJolZRVipOqPIxfujem2K/WN7q/kFMpU+HS5vis1LeR 81jh7R+zB3DJRIRkwvFMPBYCJiyBRx0skayKAvZCCbDRzlKbAsgDUW77jn117WL/v7ut iH1IzhS6/LXi2OE695XItpzBWLNNj9CARvwp2MaYnFXsbUd2WL91bzht0RrKNle8MbLx ooV/2pO1AG9SLBlQ5hpCXcHB8AWo1MwaiqHPSUurSYIUHKyOcQ0LsfMwWflzaqtblYOr WZKf1SpZaSxRFqHM0NJvqRt81hFx4g8DK/pBI7vyHOXwWQxDEraDhjzVlrintmIEhOtr vNuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qmvRNGGf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my17-20020a1709065a5100b007c4fb520308si10306448ejc.945.2022.12.20.05.46.46; Tue, 20 Dec 2022 05:47:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qmvRNGGf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233849AbiLTNMT (ORCPT + 70 others); Tue, 20 Dec 2022 08:12:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233859AbiLTNMQ (ORCPT ); Tue, 20 Dec 2022 08:12:16 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99F1D192BC for ; Tue, 20 Dec 2022 05:12:11 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id d14so17349876edj.11 for ; Tue, 20 Dec 2022 05:12:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:subject:cc:to:from:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=j4EnR1Q2u0KKc+AisGhIqSegw9gJYBOb4g7u1uoRDKQ=; b=qmvRNGGfv5Q9RsUhDR3YCEjut9VKcvoxCb2plew0zftB4wQ8tjg807fW2FKQm+1pKH EEQSA0ArV/KMpzFq7hAjCnubq84xon/6NTjdw8Wqh6lmI716+A4tAc+dltkK/C/4upFG X8BOnx37ut/P/VRj+frZWrFfo23RUwWAT9jtviN66lYYP1OlHQG5xKXwlHpNmEkqy/0j ZCvjfSoqcgndd7+TsgtOM4Oo3NC1NUKZ8btlLAJ9ANu9h16bEuPi/gn8WU485VIJYpHH A9+Ch8k/OBtl7Jiofz+9C2h267cAuBLUcdeSidbIOWbplcpyf6qELDIl804wJkQ4BULl BB3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:cc:to:from:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=j4EnR1Q2u0KKc+AisGhIqSegw9gJYBOb4g7u1uoRDKQ=; b=xgYU5wL+1OV3CRRu1A4mWc5oRZSlaJY/F846tRTVUo9Nn+EhbNpE25cOCuKiovQJyG Aqdy6gL/SXg5CRgBuOrZA8o9YO3hxpUHkNDdDisiFmOKMqWY25xly4xuued8JiFOzG4f pIF52ldbHW33lCDLuzaRvzIWH+lmOai6XC5L0DTeeqCAuBtBRiYtyDuLWxrOC5uW9832 3d2ydGQFUuSM5Vrz4CjAlrnVAeX5Qimo3Zw32JvYeITOzY50Q29ZUp1+fChsDxYEVLmK cS+m/4TFfz22/GeSal6bt1qavbqxvl/dHHiErwY+W5xt4AINI1OSzZuPXuIlE4TGdaIs FiDQ== X-Gm-Message-State: ANoB5pk8qhW7Oz8n5G3NWavy8e+jwz8yfOCkM3NVysDObk+fJSfgMbsD xnZQsLHD6gmniYDfrsR983drAw== X-Received: by 2002:aa7:db43:0:b0:46c:2c94:d30b with SMTP id n3-20020aa7db43000000b0046c2c94d30bmr54636028edt.33.1671541930207; Tue, 20 Dec 2022 05:12:10 -0800 (PST) Received: from [192.168.0.104] ([82.77.81.131]) by smtp.gmail.com with ESMTPSA id h31-20020a0564020e9f00b0046ba536ce52sm5533691eda.95.2022.12.20.05.12.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 05:12:09 -0800 (PST) Message-ID: <82b18028-7246-9af9-c992-528a0e77f6ba@linaro.org> Date: Tue, 20 Dec 2022 15:12:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US From: Tudor Ambarus To: mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, edumazet@google.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, willemb@google.com, syzkaller@googlegroups.com, liuhangbin@gmail.com Cc: linux-kernel@vger.kernel.org, joneslee@google.com Subject: kernel BUG in __skb_gso_segment Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, There's a bug [1] reported by syzkaller in linux-5.15.y that I'd like to squash. The commit in stable that introduces the bug is: b99c71f90978 net: skip virtio_net_hdr_set_proto if protocol already set The upstream commit for this is: 1ed1d592113959f00cc552c3b9f47ca2d157768f I discovered that in mainline this bug was squashed by the following commits: e9d3f80935b6 ("net/af_packet: make sure to pull mac header") dfed913e8b55 ("net/af_packet: add VLAN support for AF_PACKET SOCK_RAW GSO") I'm seeking for some guidance on how to fix linux-5.15.y. From what I understand, the bug in stable is triggered because we end up with a header offset of 18, that eventually triggers the GSO crash in __skb_pull. If I revert the commit in culprit from linux-5.15.y, we'll end up with a header offset of 14, the bug is not hit and the packet is dropped at validate_xmit_skb() time. I'm wondering if reverting it is the right thing to do, as the commit is marked as a fix. Backporting the 2 commits from mainline is not an option as they introduce new support. Would such a patch be better than reverting the offending commit? diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index a960de68ac69..188b6f05e5bd 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -25,7 +25,7 @@ static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type) static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, const struct virtio_net_hdr *hdr) { - if (skb->protocol) + if (skb->protocol && skb->protocol != htons(ETH_P_ALL)) return 0; switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { Thanks! ta [1] https://syzkaller.appspot.com/bug?id=ce5575575f074c33ff80d104f5baee26f22e95f5