Skip to content

bpf, x64: Fix tailcall hierarchy

Leon Hwang bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 22 repliesIn review

Changes in v1 from the cover letter

* address comments from Maciej:
* Replace all memcpy(prog, x86_nops[5], X86_PATCH_SIZE) with emit_nops(&prog, X86_PATCH_SIZE)

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bpf, x64: Use emit_nops() to replace memcpy()'ing x86_nops[5]arch/x86/net/bpf_jit_comp.c+22 -250 replies
2/4bpf, x64: Fix tailcall hierarchyarch/x86/net/bpf_jit_comp.c+24 -1622 replies
3/4bpf, x64: Rename RESTORE_TAIL_CALL_CNT() to LOAD_TAIL_CALL_CNT_PTR()arch/x86/net/bpf_jit_comp.c+10 -110 replies
4/4selftests/bpf: Add testcases for tailcall hierarchy fixingtools/testing/selftests/bpf/prog_tests/tailcalls.c tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy1.c tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c +1 more+553 -00 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchMaciej Fijalkowski
1/4
2/4R-b
3/4
4/4

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

Read the v1 thread

Cover letter [PATCH bpf-next 0/4] bpf, x64: Fix tailcall hierarchy

The patchset fixes a tailcall hierarchy issue.

The issue is confirmed in the discussions of "bpf, x64: Fix tailcall infinite loop"[0].

The issue is only resolved on x86.

Hopefully, the issue on arm64 and s390x will be resolved soon.

I provide a long commit message in the second patch to describe how the issue happens and how this patchset resolves the issue in detail.

RFC v2 -> v1:
* address comments from Maciej:
* Replace all memcpy(prog, x86_nops[5], X86_PATCH_SIZE) with emit_nops(&prog, X86_PATCH_SIZE)

RFC v1 -> RFC v2:
* address comments from Stanislav:
* Separate moving emit_nops() as first patch.

Links:
[0] https://lore.kernel.org/bpf/[email protected]/

Leon Hwang (4):
bpf, x64: Use emit_nops() to replace memcpy()'ing x86_nops[5] bpf, x64: Fix tailcall hierarchy
bpf, x64: Rename RESTORE_TAIL_CALL_CNT() to LOAD_TAIL_CALL_CNT_PTR() selftests/bpf: Add testcases for tailcall hierarchy fixing

 arch/x86/net/bpf_jit_comp.c                   | 108 ++---
 .../selftests/bpf/prog_tests/tailcalls.c      | 418 ++++++++++++++++++
 .../bpf/progs/tailcall_bpf2bpf_hierarchy1.c   |  34 ++
 .../bpf/progs/tailcall_bpf2bpf_hierarchy2.c   |  55 +++
 .../bpf/progs/tailcall_bpf2bpf_hierarchy3.c   |  46 ++
 5 files changed, 609 insertions(+), 52 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy1.c
 create mode 100644 tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
 create mode 100644 tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy3.c

base-commit: 0c14840ae36f8170f06c2fa768203ef5a8e389e1

Signature · 1 line
2.42.1