From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (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 16E5339B4A9 for ; Thu, 26 Mar 2026 17:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774547377; cv=none; b=M6PoVRU53SXFjN3IwBjZO96KEAxzadxnpDvMA0kMDHl5fASjON0bFQcPEynZ2pf+stc3ovFI/uDQTOCttueqfz1913iJZ4r0DdS669yMifa3kqfMMZ5zC7lqjtPk2ag9dr8pzEIHMjdgNnb1oCvEE0lfN6IW8wXjofaIRw9gBx8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774547377; c=relaxed/simple; bh=Ys8BVN0x3U87U6nb5s7SqO4PUjwOesE4M8Kiph+9P6s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZDeAM98R+AAqzbV2K5VTj4r5cjX0QuumIICNweCfHOulhL4U2DHg0o9dQ6bgAf7aKtjT2CQ3OiYMiWq9foBsB4k3pWfBoG28nKq6wA5fvm6hrbKDmypLvCUj79uJjME4yQJMfw4htH1dO95GelPgbREJUiiAfT1FsLWyJBEeyek= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Wb3kqIg8; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Wb3kqIg8" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1774547361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pZzE7Lq+Wi/ClrVVHCpj5Th0qEok0qKHryuF5ubIT4s=; b=Wb3kqIg8DT0FCwK8Sajf0T8vfYIDFjXuvV+JIxaCOsQHmvS8CZc1vv7ceUVlNKanVPigEH Sh5J4c7epGiRzznou9TavQlH1hb58SCRcIC2tifQcHzTC4rWg2yz/tiXqJycf3HJK0Twgl sR9ei6ymSpsUNPgfMMG/67R4+fYe5zo= Date: Thu, 26 Mar 2026 10:49:14 -0700 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 3/5] bpf: add helper masks for ADJ_ROOM flags and encap validation To: "Hudson, Nick" Cc: Willem de Bruijn , "Tottenham, Max" , "Glasgall, Anna" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "bpf@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20260318134242.2725749-1-nhudson@akamai.com> <20260318134242.2725749-4-nhudson@akamai.com> <9E9BE3BD-1640-49E7-8801-130945073B24@akamai.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <9E9BE3BD-1640-49E7-8801-130945073B24@akamai.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 3/26/26 10:02 AM, Hudson, Nick wrote: >>> static int bpf_skb_net_grow(struct sk_buff *skb, u32 off, u32 len_diff, >>> u64 flags) >>> @@ -3502,6 +3513,11 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 off, u32 len_diff, >>> unsigned int gso_type = SKB_GSO_DODGY; >>> int ret; >>> + if (unlikely(flags & ~(BPF_F_ADJ_ROOM_ENCAP_MASK | >>> + BPF_F_ADJ_ROOM_NO_CSUM_RESET | >>> + BPF_F_ADJ_ROOM_FIXED_GSO))) >> Under which case this new check will be hit? > If a user supplies +ve len_diff and attempts to pass a DECAP flag. > > The commit message had > > Add flag validation to bpf_skb_net_grow() to reject invalid encap > flags early. There is DECAP_MASK check in bpf_skb_adjust_room() and then !shrink is rejected. What am I missing?