Skip to content

xdp: fix page_pool leaks

Maciej Fijalkowski bpf netdev 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 11 repliesIn review
  2. v42 patches 6 repliesSuperseded
  3. v32 patches 2 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v22 patches13 repliesSuperseded
v12 patches10 repliesSuperseded

Changes in v5 from the cover letter

- rely again on sk_buff::pp_recycle when setting mem type on rxq (Jesper, Jakub)
- add ack from Toke on patch 2 and restore it on patch 1

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xdp: introduce xdp_convert_skb_to_buff()include/net/xdp.h net/core/dev.c+29 -219 replies
2/2veth: update mem type in xdp_buffdrivers/net/veth.c+26 -172 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchIhor SolodraiToke Høiland-Jørgensen
1/2T-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 bpf 0/2] xdp: fix page_pool leaks

v1:
https://lore.kernel.org/bpf/[email protected]/
v1->v2:
- add skb to xdp_buff converter (Jakub)
- postpone restoration of veth's xdp_rxq_info mem model (AI)

v2:
https://lore.kernel.org/bpf/[email protected]/T/
v2->v3:
- make skb->xdp_buff conversion agnostic of current skb->data position (Toke)
- do not pull mac header in veth (Toke)
- use virt_to_head_page() when checking if xdp->data comes from page_pool (Olek)
- add ack from Toke

v3:
https://lore.kernel.org/bpf/[email protected]/
v3->v4:
- include skb->head when calculating packet length (Toke, lkp)

v4:
https://lore.kernel.org/bpf/[email protected]/
v4->v5:
- rely again on sk_buff::pp_recycle when setting mem type on rxq (Jesper, Jakub)
- add ack from Toke on patch 2 and restore it on patch 1

Hi,

here we fix page_pool leaks which happen when fragment is released within XDP program and memory type is set incorrectly. The reports come from syzbot and AF_XDP test suite.

Most of the changes are about pulling out the common code for init/prepare xdp_buff based on existing skb and supplying it with correct xdp_rxq_info's mem_type that is assigned to xdp_buff. A bit more stuff, page_pool related, had to be done on veth side.

Originally, this work was started by Octavian Purdila.

Thanks!

Maciej Fijalkowski (2):
xdp: introduce xdp_convert_skb_to_buff()
veth: update mem type in xdp_buff

 drivers/net/veth.c | 43 ++++++++++++++++++++++++++-----------------
 include/net/xdp.h  | 25 +++++++++++++++++++++++++
 net/core/dev.c     | 25 ++++---------------------
 3 files changed, 55 insertions(+), 38 deletions(-)
Signature · 1 line
2.43.0