All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] double-fix bpf_test_run + XDP_PASS recycling
@ 2023-03-16 17:50 Alexander Lobakin
  2023-03-16 17:50 ` [PATCH bpf-next 1/2] bpf, test_run: fix crashes due to XDP frame overwriting/corruption Alexander Lobakin
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alexander Lobakin @ 2023-03-16 17:50 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau
  Cc: Alexander Lobakin, Maciej Fijalkowski, Larysa Zaremba,
	Toke Høiland-Jørgensen, Ilya Leoshkevich, Song Liu,
	Jesper Dangaard Brouer, Jakub Kicinski, bpf, netdev,
	linux-kernel

Enabling skb PP recycling revealed a couple issues in the bpf_test_run
code. Recycling broke the assumption that the headroom won't ever be
touched during the test_run execution: xdp_scrub_frame() invalidates the
XDP frame at the headroom start, while neigh xmit code overwrites 2 bytes
to the left of the Ethernet header. The first makes the kernel panic in
certain cases, while the second breaks xdp_do_redirect selftest on BE.
test_run is a limited-scope entity, so let's hope no more corner cases
will happen here or at least they will be as easy and pleasant to fix
as those two.

Alexander Lobakin (2):
  bpf, test_run: fix crashes due to XDP frame overwriting/corruption
  selftests/bpf: fix "metadata marker" getting overwritten by the
    netstack

 net/bpf/test_run.c                                   | 12 +++++++++++-
 .../selftests/bpf/prog_tests/xdp_do_redirect.c       |  7 ++++---
 .../selftests/bpf/progs/test_xdp_do_redirect.c       |  2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

-- 
2.39.2


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

end of thread, other threads:[~2023-03-17 13:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 17:50 [PATCH bpf-next 0/2] double-fix bpf_test_run + XDP_PASS recycling Alexander Lobakin
2023-03-16 17:50 ` [PATCH bpf-next 1/2] bpf, test_run: fix crashes due to XDP frame overwriting/corruption Alexander Lobakin
2023-03-16 20:09   ` Toke Høiland-Jørgensen
2023-03-16 21:21   ` Ilya Leoshkevich
2023-03-16 17:50 ` [PATCH bpf-next 2/2] selftests/bpf: fix "metadata marker" getting overwritten by the netstack Alexander Lobakin
2023-03-16 20:10   ` Toke Høiland-Jørgensen
2023-03-17 13:38     ` Alexander Lobakin
2023-03-16 21:22   ` Ilya Leoshkevich
2023-03-17 13:40     ` Alexander Lobakin
2023-03-17  5:30 ` [PATCH bpf-next 0/2] double-fix bpf_test_run + XDP_PASS recycling patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.