From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (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 BC2A338F64E for ; Thu, 26 Mar 2026 17:49:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774547368; cv=none; b=X5ruw04RE/osUFGyekJN0HNxZa6e4mYFoIXJhIwSoscPUAlK9PD5XLZYr7CHCkljG/PDvaR+bkL/slCkYLG5tcDdg3r6MGo8IRNHym9ZfKsiZLHDIa6U8U5D7bgVzVnx5rkbjWJfYhnZPvob3SqKlMco8zFX+kA3jOCvAbb+t98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774547368; c=relaxed/simple; bh=Ys8BVN0x3U87U6nb5s7SqO4PUjwOesE4M8Kiph+9P6s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=c06QCgLTHdqYMGclCglcdQ5mSsi58OkMmyeuvRzXp/AA0hzkO0vQ/dMibcJyZBAkf4ra+Kn3pAtVkErrFxi19LF+wSAsTlL5bsq2AJtJNuvN4bCWoU8Rhk3HQp+DZJI0h+9LOB8/fP9S5+tmKuzsknWYantdp/qOmFmacfQ84N8= 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.170 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: linux-kernel@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?