Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1643599lqa; Mon, 29 Apr 2024 14:53:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtE+sb04Bp/+I/CrCt/kL0M1d3TeUm0XQV/uIva3E3uGPxxj7kbY6jMnctBD0o2aUN5naDaWBIj5ecL9aFvG8gtisPxLs246E2XbWQSA== X-Google-Smtp-Source: AGHT+IHV4PVOKnVvrLV2eJ0UyDENVSvY1+D1XRTFfhbPnyQKSoJgghXzFxydn/QeNIBBHKPP/aLC X-Received: by 2002:a17:90a:4a07:b0:2b1:faae:36ce with SMTP id e7-20020a17090a4a0700b002b1faae36cemr2966913pjh.14.1714427596464; Mon, 29 Apr 2024 14:53:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714427596; cv=pass; d=google.com; s=arc-20160816; b=jzNxNSqNTy/Ckxu/DNOQmiQyxs9x38c4X4puNLEjN/9CuR+/aCancM9jsihaMX0Qut b0t7dIeCx37dtHjZEPYstyfAciBUB4cBs8WmioyrJN7lZG6kCpzWB4q2gnUjTgHmrbsK 2D16DFEt7vfwZUd8ABN4cZZVZblyoCpv0Ffqsktj5pdFHe9D8vMX0X1ssNI3SLEd8blL RZyk1cOfytYCybmIcGHwLXPNCZrbTaUZzROe3e2TEj2RVs+xZsX5Jf5tkDov1TmR0isk lBtoEq/YUiUc7KqnCD5jz/3yvA/ucqgIUMpA0IM2AncgZavueE/QmlaQ+FXAn7yDiLHm b+rQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:cc:to:from:date:dkim-signature; bh=NQPuAKB6zxzSBJxoiuturNalOncl1ZZO2UKPOMfyZOo=; fh=iiPa8YOAWhe/EGEKSdfltlWARsR3PqC/RjRfVkeK6Dc=; b=X5zr/Y1dcEp+iGFv4nDnF2to755D92yYISI/lWnHcr0UmM0RA3F9baxVLLUyn/fBRo LhtZkPknTnVPmHetJ/ndntNP4oFqPjWWzlb5M6zxqlIv4cItkayUr+Z46j9dBk+o75WO tH/EVsxUhut1gi6VWKOaffkJDvQ6O6mraSft2FK6b8qFGp60YbPR/KTaote8YQhaXh+u CwTwQAsgzp7Pxvh2FuYaaW0OBz4rgQ4cnxYlXomzYADVmxOZHlYH+x07xMyYyUJTssEs T5IaotnQO7khposTdcgteT5sQfwYSSW2ubrfgpcliAzRqoIA5Xk9knGQZjrYy8NywC8S bMNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NEZ97k5u; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163061-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s35-20020a17090a2f2600b002a525ac4628si8455319pjd.137.2024.04.29.14.53.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 14:53:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163061-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=@gmail.com header.s=20230601 header.b=NEZ97k5u; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163061-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 E1C4A289D7C for ; Mon, 29 Apr 2024 21:15:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DCFE181BBA; Mon, 29 Apr 2024 21:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NEZ97k5u" Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 308C73C482; Mon, 29 Apr 2024 21:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714425301; cv=none; b=lAOVTwcAFI3Hgd/rqw0rtN2H8jIVlgYAYfIZfUf5IgKmteRzr5mcb6Mfea56l4QGar4zmOAA6/OEOydxsgG7SYrOEw2c+E+dHKjFAbkF8rcnoJJnAdsDLzJhpJjX7DdnR6elRAQMfQqLF1Nnb2Ppx/4LAyY9TmZr7T627aIY8m0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714425301; c=relaxed/simple; bh=7+2sYOL5fqWMncPIRsbxS0iXQhfb/BgV4yUmovNTXdw=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=lqhi6lGuguVUZK2gyzfJus58nqshSSmcPrKMErPWdtmvuMTHGl2fIgk9LE/2/1fXwM8DTU6iiUDLoeoNrAvUHEg70wd+MLBBeOvrDizm822pBPEzktlRLOSisR2hmG9DnlfeheK2YIGYaZ3WhhEd0jk8SDwSz5GxJ5Azizv855M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NEZ97k5u; arc=none smtp.client-ip=209.85.128.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-618874234c9so56671867b3.0; Mon, 29 Apr 2024 14:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714425299; x=1715030099; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=NQPuAKB6zxzSBJxoiuturNalOncl1ZZO2UKPOMfyZOo=; b=NEZ97k5un/4rEGrIj4mJ2hKl0ZoCOcLZ4aOur4xJt19y9k8sd7hniPPDp2if+KaQYN XFGB7uc3554Pqx0w/eAco5oqUQI+v9i+/kh5XATJgqMN9FXr2tsNWeDmLjqjsJM9JUqt riGnwz4w1OuJt0FqcbovPsR2HnYBCG2buIW6UpGL0kpFNv2PjLY7IHrlC5f00WhoEKtL EIXTqYUgKKVcNUoTPN08fs5RNXyzlJJ8vncJkcbar94nbunhe/o21/db2rUltrom5tQh OYIH3jN+V0c1d18EviFHMKQu+CQL1AHcwwmWP0dPqHqE0OJnLOlMLSQC8XcmecCFgS/w jndg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714425299; x=1715030099; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=NQPuAKB6zxzSBJxoiuturNalOncl1ZZO2UKPOMfyZOo=; b=H/O+mlO3axNceTDqHTD23aH56e2GXXDkXW9BCJlbxJWWyqqYTyTVMBJKj93Znnjl+p z2/GArxjOmGbUoHK6+uUX5UIZLYWj7Yo0hItvKfH63xml6UnD9lX4kTc/hU80JAEDE+Q cSMu1drGbWfH/rNJu0p6DcJp+9mJRZ7/oUcbJuGpuMPccVAbI/suV96rbSoRvl8YeLIL vR7fLZL/ic9qSGyOAsDsgJByXiJmJE3J+yG+J23q1x8Hiy+6G+2fXIfy0LdtkVIRH7CU GKwVxvE6AEcFRyBeq06BKYBNfrDznUFWHY1nY3GS8FlC5YylOVZa9j9X+UISZPjEl18o 40SQ== X-Forwarded-Encrypted: i=1; AJvYcCULzJ0epknS4OAYDawg5NNvqrm1GjoUo5hCOrFxEUJU027XBGc8fQqvtqk8Qbi/QfKwLfFkV+/nYz672bR/BRfAAg99k+oobQG8GVG3OVeroVn5TTuZnvOJmWjP X-Gm-Message-State: AOJu0YziTCAHwF36hlf2S+FMt6pFu3XlpoC/1/TDoWXiuGlag2NwwxdK 9sSb+1Cd5P0qOQcCausYpQE8nU7UTezCjSco2/Vv5Vi1XLqdssCJfQpStA== X-Received: by 2002:a25:870b:0:b0:dbd:be40:2191 with SMTP id a11-20020a25870b000000b00dbdbe402191mr10768280ybl.42.1714425299108; Mon, 29 Apr 2024 14:14:59 -0700 (PDT) Received: from localhost (164.146.150.34.bc.googleusercontent.com. [34.150.146.164]) by smtp.gmail.com with ESMTPSA id a5-20020ac81085000000b00434a165d45asm10753716qtj.38.2024.04.29.14.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 14:14:58 -0700 (PDT) Date: Mon, 29 Apr 2024 17:14:58 -0400 From: Willem de Bruijn To: Daniel Borkmann , =?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" Message-ID: <66300dd27bc48_2f15ff2944a@willemb.c.googlers.com.notmuch> In-Reply-To: <880367ab-e9a2-d9b4-c6d6-9e2efdf04a0f@iogearbox.net> References: <20240415150103.23316-1-shiming.cheng@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> <662cfd6db06df_28b9852949a@willemb.c.googlers.com.notmuch> <5cc1c662-1cec-101c-8184-c32c210eeadc@iogearbox.net> <880367ab-e9a2-d9b4-c6d6-9e2efdf04a0f@iogearbox.net> Subject: Re: [PATCH net] udp: fix segmentation crash for GRO packet without fraglist Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit > >> The 'write_len > skb_headlen(skb)' test is redundant, no ? > >> > >> It is covered by the earlier test : > >> > >> if (likely(len <= skb_headlen(skb))) > >> return SKB_NOT_DROPPED_YET; > >> > > Daniel, it is not redundant. The bpf pulls a len between > > skb_headlen(skb) and skb->len that results in error. Here it will stop > > this operation. For other skbs(not SKB_GSO_FRAGLIST) it could be a > > normal behaviour and will continue to do next pulling. > > I meant something like the below. The len <= skb_headlen(skb) case you > already return earlier with SKB_NOT_DROPPED_YET. Willem, do you see a > case where this should not live in pskb_may_pull_reason() but rather > specifically in skb_ensure_writable()? Yes. pskb_may_pull is called all over the hot path. All in locations that are known safe, because they only pull header bytes. I prefer to limit the branch to the few (user configurable) locations that are in scope.