Skip to content

RFC Do not include the original insn in zext patchlet

Ilya Leoshkevich bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5bpf: Make bpf_patch_insn_single() accept variable number of old insnsinclude/linux/filter.h kernel/bpf/core.c kernel/bpf/verifier.c+12 -120 replies
2/5bpf: Make adjust_insn_aux_data() accept variable number of old insnskernel/bpf/verifier.c+19 -140 replies
3/5bpf: Make adjust_subprog_starts() accept variable number of old insnskernel/bpf/verifier.c+5 -40 replies
4/5bpf: Make bpf_patch_insn_data() accept variable number of old insnskernel/bpf/verifier.c+27 -170 replies
5/5bpf: Do not include the original insn in zext patchletkernel/bpf/verifier.c+11 -96 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC bpf-next 0/5] Do not include the original insn in zext patchlet

Hi!

This patch series attempts to fix test_progs failure on s390, which Yauheni reported here:

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

The problem is that zext code includes the instruction, whose result needs to be zero-extended, into the zero-extension patchlet. If this instruction happens to be a call, its delta is not adjusted, and as a result verifier rejects the program later.

The code seems to have been written this way, because there is no helper function to insert bpf instructions: currently one can either replace or remove. So insertion seems to have been emulated with replacement.

Patches 1-4 teach bpf_patch_insn_data() how to insert (by accepting variable number of old insns, which is normally 1, but can now be 0 too). Patch 5 uses this new capability to resolve the issue.

Ilya Leoshkevich (5):
bpf: Make bpf_patch_insn_single() accept variable number of old insns
bpf: Make adjust_insn_aux_data() accept variable number of old insns
bpf: Make adjust_subprog_starts() accept variable number of old insns
bpf: Make bpf_patch_insn_data() accept variable number of old insns
bpf: Do not include the original insn in zext patchlet

 include/linux/filter.h |   4 +-
 kernel/bpf/core.c      |  18 ++++----
 kernel/bpf/verifier.c  | 100 ++++++++++++++++++++++++-----------------
 3 files changed, 70 insertions(+), 52 deletions(-)
Signature · 1 line
2.25.4