lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9deda78a-a9a2-6b0b-634d-07c5b77282a8@iogearbox.net>
Date:   Mon, 1 Nov 2021 22:46:10 +0100
From:   Daniel Borkmann <daniel@...earbox.net>
To:     xiangxia.m.yue@...il.com, netdev@...r.kernel.org
Cc:     Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH] net: core: set skb useful vars in __bpf_tx_skb

On 10/29/21 3:54 AM, xiangxia.m.yue@...il.com wrote:
[...]
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 4bace37a6a44..2dbff0944768 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -2107,9 +2107,19 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
>   		return -ENETDOWN;
>   	}
>   
> -	skb->dev = dev;
> +	/* The target netdevice (e.g. ifb) may use the:
> +	 * - skb_iif
> +	 * - redirected
> +	 * - from_ingress
> +	 */
> +	skb->skb_iif = skb->dev->ifindex;

This doesn't look right to me to set it unconditionally in tx path, isn't ifb_ri_tasklet()
setting skb->skb_iif in this case (or __netif_receive_skb_core() in main rx path)?

Also, I would suggest to add a proper BPF selftest which outlines the issue you're solving
in here.

> +#ifdef CONFIG_NET_CLS_ACT
> +	skb_set_redirected(skb, skb->tc_at_ingress);
> +#else
>   	skb->tstamp = 0;
> +#endif
>   
> +	skb->dev = dev;
>   	dev_xmit_recursion_inc();
>   	ret = dev_queue_xmit(skb);
>   	dev_xmit_recursion_dec();
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ