Subject: Re: [bpf, xdp] headroom - was: Re: Question about to KMSAN: uninit-value in can_receive

From: Jakub Kicinski <[email-masked]>
Date: Mon, 5 Jan 2026 15:26:38 -0800

On Mon, 5 Jan 2026 14:47:08 +0100 Oliver Hartkopp wrote:
> For the ifindex I would propose to store it in struct skb_shared_info:
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 86737076101d..f7233b8f461c 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -604,10 +604,15 @@ struct skb_shared_info {
>                  struct xsk_tx_metadata_compl xsk_meta;
>          };
>          unsigned int    gso_type;
>          u32             tskey;
> 
> +#if IS_ENABLED(CONFIG_CAN)
> +       /* initial CAN iif to avoid routing back to it (can-gw) */
> +       int can_iif;
> +#endif
> +
>          /*
>           * Warning : all fields before dataref are cleared in __alloc_skb()
>           */
>          atomic_t        dataref;
> 
> Would this be a suitable approach to get rid of struct can_skb_priv in 
> your opinion?

Possibly a naive question but why is skb_iif not working here?