Skip to contentSkip to conversation

xdp: ensure initialization of txq in xdp_buff

PATCH In review Paul Hollinsky 2 participants 2 messages Aug 8, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xdp: ensure initialization of txq in xdp_buff

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

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

---
 net/core/dev.c | 2 ++
 1 file changed, 2 insertions(+)
net/core/dev.c +2 -0
index 7df6c9617321..12be8fef8b7e 100644
@@ -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 */
Signature · 1 line
2.25.1
#1 lore raw
Quoted 1 line · Paul Hollinsky

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.

Quoted 22 lines

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

---
 net/core/dev.c | 2 ++
 1 file changed, 2 insertions(+)
net/core/dev.c +2 -0
index 7df6c9617321..12be8fef8b7e 100644
@@ -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 */