Re: [PATCH bpf-next v4 6/6] selftests/bpf: tc_tunnel validate decap GSO state

Martin KaFai Lau <[email protected]>
Newsgroups dev.linux.lists.sashiko,org.kernel.vger.bpf
Message-ID <[email protected]>
On Thu, Apr 16, 2026 at 12:43:24PM +0000, [email protected] wrote:
> Sashiko AI review found 3 potential issue(s):

> - [Low] Invalid pointer arithmetic (`kskb->head + kskb->end`) causes a compilation failure on 32-bit architectures.

> > @@ -655,6 +684,35 @@ static int decap_internal(struct __sk_buff *skb, int off, int len, char proto)
> >  	if (bpf_skb_adjust_room(skb, -olen, BPF_ADJ_ROOM_MAC, flags))
> >  		return TC_ACT_SHOT;
> >  
> > +	kskb = bpf_cast_to_kern_ctx(skb);
> > +	shinfo = bpf_core_cast(kskb->head + kskb->end, struct skb_shared_info);
> 
> Will this cause a compilation failure on 32-bit architectures?
> 
> On 32-bit architectures without NET_SKBUFF_DATA_USES_OFFSET, sk_buff::end
> is defined as a pointer (unsigned char *) rather than an offset. Adding two
> pointers is an invalid operation in C and will result in a build error.

Other tests have been using it to get shinfo already. I would leave it as is.
If it really would be needed to run and compile on 32-bit in the future,
it could use bpf_core_field_size(kskb->end) and then do things differently.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.