netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xdp: ensure initialization of txq in xdp_buff
@ 2020-08-08  7:16 Paul Hollinsky
  2020-08-08 15:56 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Hollinsky @ 2020-08-08  7:16 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, andriin, ast, bpf, daniel, hawk, john.fastabend,
	kafai, kpsingh, songliubraving, yhs, Paul Hollinsky

xdp->txq was uninitialized and could be used from within a bpf program.

https://syzkaller.appspot.com/bug?id=a6e53f8e9044ea456ea1636be970518ae6ba7f62

Signed-off-by: Paul Hollinsky <phollinsky@holtechnik.com>
---
 net/core/dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 7df6c9617321..12be8fef8b7e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4649,6 +4649,8 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
 	rxqueue = netif_get_rxqueue(skb);
 	xdp->rxq = &rxqueue->xdp_rxq;
 
+	xdp->txq = NULL;
+
 	act = bpf_prog_run_xdp(xdp_prog, xdp);
 
 	/* check if bpf_xdp_adjust_head was used */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xdp: ensure initialization of txq in xdp_buff
  2020-08-08  7:16 [PATCH] xdp: ensure initialization of txq in xdp_buff Paul Hollinsky
@ 2020-08-08 15:56 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2020-08-08 15:56 UTC (permalink / raw)
  To: Paul Hollinsky, netdev
  Cc: davem, kuba, andriin, ast, bpf, daniel, hawk, john.fastabend,
	kafai, kpsingh, songliubraving, yhs

On 8/8/20 1:16 AM, Paul Hollinsky wrote:
> xdp->txq was uninitialized and could be used from within a bpf program.

The verifier prevents access to txq except by programs of type
BPF_XDP_DEVMAP and those can not be run via xdp generic. ie., generic
can not access txq.


> 
> https://syzkaller.appspot.com/bug?id=a6e53f8e9044ea456ea1636be970518ae6ba7f62
> 
> Signed-off-by: Paul Hollinsky <phollinsky@holtechnik.com>
> ---
>  net/core/dev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 7df6c9617321..12be8fef8b7e 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4649,6 +4649,8 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
>  	rxqueue = netif_get_rxqueue(skb);
>  	xdp->rxq = &rxqueue->xdp_rxq;
>  
> +	xdp->txq = NULL;
> +
>  	act = bpf_prog_run_xdp(xdp_prog, xdp);
>  
>  	/* check if bpf_xdp_adjust_head was used */
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-08 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  7:16 [PATCH] xdp: ensure initialization of txq in xdp_buff Paul Hollinsky
2020-08-08 15:56 ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).