Skip to content

bpf: stack depth tracking

Alexei Starovoitov netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9bpf: free up BPF_JMP | BPF_CALL | BPF_X opcodearch/arm64/net/bpf_jit_comp.c arch/powerpc/net/bpf_jit_comp64.c arch/s390/net/bpf_jit_comp.c +5 more+10 -70 replies
2/9bpf: split bpf core interpreterkernel/bpf/core.c+14 -70 replies
3/9bpf: teach verifier to track stack depthinclude/linux/bpf.h kernel/bpf/verifier.c+10 -10 replies
4/9bpf: reconcile bpf_tail_call and stack_depthkernel/bpf/verifier.c+1 -00 replies
5/9bpf: track stack depth of classic bpf programsnet/core/filter.c+22 -140 replies
6/9bpf: fix stack_depth usage by test_bpf.kolib/test_bpf.c+24 -17 replies
7/9bpf: use different interpreter depending on required stack sizekernel/bpf/core.c+31 -90 replies
8/9bpf: change x86 JITed program stack layoutarch/x86/net/bpf_jit.S arch/x86/net/bpf_jit_comp.c+40 -380 replies
9/9bpf: take advantage of stack_depth tracking in x64 JITarch/x86/net/bpf_jit_comp.c+5 -40 replies

Reviews trailers per patch

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

PatchDaniel Borkmann
1/9A-b
2/9A-b
3/9A-b
4/9A-b
5/9A-b
6/9A-b
7/9A-b
8/9A-b
9/9A-b

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 net-next 0/9] bpf: stack depth tracking

Introduce tracking of bpf program stack depth in the verifier and use that info to reduce bpf program stack consumption in the interpreter and x64 JIT. Other JITs can take advantage of it as well in the future.
Most of the programs consume very little stack, so it's good optimization in general and it's the first step toward bpf to bpf function calls.

Also use internal opcode for bpf_tail_call() marking to make clear that jmp|call|x opcode is not uapi and may be used for actual indirect call opcode in the future.

Alexei Starovoitov (9):
bpf: free up BPF_JMP | BPF_CALL | BPF_X opcode
bpf: split bpf core interpreter
bpf: teach verifier to track stack depth
bpf: reconcile bpf_tail_call and stack_depth
bpf: track stack depth of classic bpf programs
bpf: fix stack_depth usage by test_bpf.ko
bpf: use different interpreter depending on required stack size
bpf: change x86 JITed program stack layout
bpf: take advantage of stack_depth tracking in x64 JIT

 arch/arm64/net/bpf_jit_comp.c     |  2 +-
 arch/powerpc/net/bpf_jit_comp64.c |  2 +-
 arch/s390/net/bpf_jit_comp.c      |  2 +-
 arch/sparc/net/bpf_jit_comp_64.c  |  2 +-
 arch/x86/net/bpf_jit.S            | 20 ++++++------
 arch/x86/net/bpf_jit_comp.c       | 65 +++++++++++++++++++++------------------
 include/linux/bpf.h               |  1 +
 include/linux/filter.h            |  3 ++
 kernel/bpf/core.c                 | 47 ++++++++++++++++++++++------
 kernel/bpf/verifier.c             | 13 ++++++--
 lib/test_bpf.c                    | 25 ++++++++++++++-
 net/core/filter.c                 | 36 +++++++++++++---------
 12 files changed, 147 insertions(+), 71 deletions(-)
Signature · 1 line
2.9.3