Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp52701lqa; Fri, 26 Apr 2024 14:08:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWESfau2UVFMdcsJUWP9DehhHUas3pnlIA7B+J0DExbE336+4OwrcuZ2rr/UXV4/n3wDGjYBkl1kUTwAxpSyI4Hh1Hj0zTd36+m4LUjfQ== X-Google-Smtp-Source: AGHT+IGHNgFMGPueEfpvp/5kARZU8vZvKdUUFGI9QykI6NDlTAVAv0YfGMUr7G3ybcoyFIAX9YHw X-Received: by 2002:a05:6a20:9691:b0:1ad:7bfd:54a1 with SMTP id hp17-20020a056a20969100b001ad7bfd54a1mr799067pzc.17.1714165716808; Fri, 26 Apr 2024 14:08:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714165716; cv=pass; d=google.com; s=arc-20160816; b=gbzJde0MWuAa/af40CNPH+GcwQsAay5Qf1LxrZjy6J5h6WP5BajgsxYD4MYn9Zwc1Z icbUDn+B7A0VACQmqAJehw6atvN/q2k/fx6474CfwCh5wvuiIItI2UDMhIcacNkDdIos /ytQLQi9ws+xHgq2PEO+AjJFmHnKfBIjObZGscVB7A5pC2smaFiz1a5N84sGQ/qtU/nw T8Q89QfYVGFd2b3VQwdS0a6+2T/07BcCqkuArEB0UvyN48AitaqmL3QJRLQHN7BvRDTC fybiMcnQvaDDeMCZOAfXCZkZTSntvloOLGIvl90U1olrYtwIxWbb274+jms3xI94KSCG YMhQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=XU9L50gMutWaXiQoUCnKhAbOZc/erS00yVvgujisH+s=; fh=jE/wDpiycp2/AdjzHec2Ub9oqhX2KJ5K3q7npzjRWM0=; b=d84T67uoHx3mry5ppjDWWc6fEqrOeZ6MptV7c0Cr3gH42hoJivf0voIxdBjMMx2iSN OzzLUH58ZQsKLBp1eeUJeD3opVS5PsxlHqilUVAG4NdaE2N6hIuuAs5K2JfFEMMhnO+U iku104fwnHR1MhVmcWjr1OeDYakCdhGuqiIXvCboi7XaR27XQSskwktbk5EO4D4d82Ds bJUF1YmnenCkx+EWGQLfjaS8Y61pZ/DqRgWHG8C/P7LfsFkJBgbH6UO+PMuUAWEfgvIE 4TQCBZyWjwfWQ0YPEnBnehqXMAOKNV5YSH/X5slm7vY7I3qotGQb0JubBOR1aCwosOe9 LW9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iogearbox.net header.s=default2302 header.b="g8p/odsG"; arc=pass (i=1 spf=pass spfdomain=iogearbox.net dkim=pass dkdomain=iogearbox.net dmarc=pass fromdomain=iogearbox.net); spf=pass (google.com: domain of linux-kernel+bounces-160682-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160682-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n20-20020a638f14000000b005f7a3af8ed5si14724651pgd.780.2024.04.26.14.08.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 14:08:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160682-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@iogearbox.net header.s=default2302 header.b="g8p/odsG"; arc=pass (i=1 spf=pass spfdomain=iogearbox.net dkim=pass dkdomain=iogearbox.net dmarc=pass fromdomain=iogearbox.net); spf=pass (google.com: domain of linux-kernel+bounces-160682-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160682-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 684242846B3 for ; Fri, 26 Apr 2024 21:08:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A22DE2E84A; Fri, 26 Apr 2024 21:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=iogearbox.net header.i=@iogearbox.net header.b="g8p/odsG" Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3275221101; Fri, 26 Apr 2024 21:08:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.133.104.62 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714165703; cv=none; b=b+YvAE3pruydzp3Zawezf/N/M/aCELvnboxJzU/ValoZ2kWEgQ02AKY+pvNCLAO4rS9lO7obWGEK6k0QumA0tmXeNUp2PMDe6AgOqvi98A4/smY2I5JdpZxTxZTA3M0DUIpASuKIPCJum1EX3iRovyAElsl5Jci3PlpKQt29PQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714165703; c=relaxed/simple; bh=lW/l8KKGYNmqkUhIpCA4l+1y/1J7i0LRaZxS7i9FoSU=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=qLdbe1Zvrub6/Z9E5UVE30QIxy09vOTDPqmDTZe4ue3gkSZDoSncMwZ9tcClATOXkAfpJkbaiVsr8R0FNh6XLhVeJYWOoQLxpW1LfUtV4gu0dXOEa2NfhQfwfA/9S4FHzUGpl/X5w9wozqYTUYe6qWa9hJCE2zuw9K9JMM2ngcE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=iogearbox.net; spf=pass smtp.mailfrom=iogearbox.net; dkim=pass (2048-bit key) header.d=iogearbox.net header.i=@iogearbox.net header.b=g8p/odsG; arc=none smtp.client-ip=213.133.104.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=iogearbox.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iogearbox.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=iogearbox.net; s=default2302; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=XU9L50gMutWaXiQoUCnKhAbOZc/erS00yVvgujisH+s=; b=g8p/odsGvImQC9g77//tEJhzbn 8neUm1aG0rRZ0Vk/6hl3/j64WgZ1Y9mBrX0Rb1ECxdv96LttbNwy4oTjcX8XsvUpEKo9aCyi5/h8W mpJMQB8EnYR1BxpGgT2vWdNhNec7U9T2CWeX1NB1EaWPlE7tzzhtb6uxhnafzSFb8F4lVVU4GJCAk g5QF/KSwWEYgozMN0A5e/INgn3c3IZVtd/9Le+FI1zxlgc7xqu0dJuCPngUQ3+o2H+gMDRoEFXbo/ 3iskDU6xOhB8XRX3nEMqbNaCs2+A4VwAWon87FL5NcLRTMMWSEX/8hmgwifUd6K+qT2BHiyKIri71 BoDzf5wQ==; Received: from sslproxy05.your-server.de ([78.46.172.2]) by www62.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s0Snl-000K9y-Bo; Fri, 26 Apr 2024 23:08:13 +0200 Received: from [178.197.249.19] (helo=linux.home) by sslproxy05.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s0Snk-000A6x-0v; Fri, 26 Apr 2024 23:08:12 +0200 Subject: Re: [PATCH net] udp: fix segmentation crash for GRO packet without fraglist To: =?UTF-8?B?TGVuYSBXYW5nICjnjovlqJwp?= , "maze@google.com" , "willemdebruijn.kernel@gmail.com" Cc: "linux-kernel@vger.kernel.org" , "bpf@vger.kernel.org" , "steffen.klassert@secunet.com" , "kuba@kernel.org" , =?UTF-8?B?U2hpbWluZyBDaGVuZyAo5oiQ6K+X5piOKQ==?= , "pabeni@redhat.com" , "edumazet@google.com" , "netdev@vger.kernel.org" , "matthias.bgg@gmail.com" , "davem@davemloft.net" , "yan@cloudflare.com" References: <20240415150103.23316-1-shiming.cheng@mediatek.com> <77068ef60212e71b270281b2ccd86c8c28ee6be3.camel@mediatek.com> <662027965bdb1_c8647294b3@willemb.c.googlers.com.notmuch> <11395231f8be21718f89981ffe3703da3f829742.camel@mediatek.com> <66227ce6c1898_116a9b294be@willemb.c.googlers.com.notmuch> <6622acdd22168_122c5b2945@willemb.c.googlers.com.notmuch> <9f097bcafc5bacead23c769df4c3f63a80dcbad5.camel@mediatek.com> <6627ff5432c3a_1759e929467@willemb.c.googlers.com.notmuch> <274c7e9837e5bbe468d19aba7718cc1cf0f9a6eb.camel@mediatek.com> <66291716bcaed_1a760729446@willemb.c.googlers.com.notmuch> <662a63aeee385_1de39b294fd@willemb.c.googlers.com.notmuch> <752468b66d2f5766ea16381a0c5d7b82ab77c5c4.camel@mediatek.com> From: Daniel Borkmann Message-ID: Date: Fri, 26 Apr 2024 23:08:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <752468b66d2f5766ea16381a0c5d7b82ab77c5c4.camel@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.10/27257/Fri Apr 26 10:25:03 2024) On 4/26/24 11:52 AM, Lena Wang (王娜) wrote: [...] >>> From 301da5c9d65652bac6091d4cd64b751b3338f8bb Mon Sep 17 00:00:00 >> 2001 >>> From: Shiming Cheng >>> Date: Wed, 24 Apr 2024 13:42:35 +0800 >>> Subject: [PATCH net] net: prevent BPF pulling SKB_GSO_FRAGLIST skb >>> >>> A SKB_GSO_FRAGLIST skb can't be pulled data >>> from its fraglist as it may result an invalid >>> segmentation or kernel exception. >>> >>> For such structured skb we limit the BPF pulling >>> data length smaller than skb_headlen() and return >>> error if exceeding. >>> >>> Fixes: 3a1296a38d0c ("net: Support GRO/GSO fraglist chaining.") >>> Signed-off-by: Shiming Cheng >>> Signed-off-by: Lena Wang >>> --- >>> net/core/filter.c | 5 +++++ >>> 1 file changed, 5 insertions(+) >>> >>> diff --git a/net/core/filter.c b/net/core/filter.c >>> index 8adf95765cdd..8ed4d5d87167 100644 >>> --- a/net/core/filter.c >>> +++ b/net/core/filter.c >>> @@ -1662,6 +1662,11 @@ static DEFINE_PER_CPU(struct bpf_scratchpad, >>> bpf_sp); >>> static inline int __bpf_try_make_writable(struct sk_buff *skb, >>> unsigned int write_len) >>> { >>> +if (skb_is_gso(skb) && >>> + (skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST) && >>> + write_len > skb_headlen(skb)) { >>> +return -ENOMEM; >>> +} >>> return skb_ensure_writable(skb, write_len); Dumb question, but should this guard be more generically part of skb_ensure_writable() internals, presumably that would be inside pskb_may_pull_reason(), or only if we ever see more code instances similar to this? Thanks, Daniel