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

"Hudson, Nick" <[email protected]>
Newsgroups dev.linux.lists.sashiko-reviews,org.kernel.vger.bpf
Message-ID <[email protected]>

> On Aug 12, 2026, at 11:20 AM, [email protected] wrote:
> 
> [Severity: Medium]
> Does this pointer arithmetic break compilation on 32-bit architectures?
> 
> Since kskb->end is a pointer on 32-bit systems (rather than an integer offset
> like it is on 64-bit), adding kskb->head and kskb->end together attempts to add
> two pointers, which is invalid in C.
> 
> Additionally, CO-RE does not translate this pointer-integer addition to a single
> pointer dereference when cross-compiled on 64-bit and run on 32-bit kernels,
> which can lead to a garbage pointer dereference.
> 
> Is there a safer way to calculate the skb_shared_info offset in decap_internal
> that is portable across both 32-bit and 64-bit architectures?


Martin KaFai Lau previously replied.

"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.”

https://lore.kernel.org/all/[email protected]/
smime.p7s (application/pkcs7-signature, 3 KB) - not displayed
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.