Skip to content

Fix narrow loads from an offset outside of target field

Jakub Sitnicki bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 3 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: Load zeros for narrow loads beyond target fieldkernel/bpf/verifier.c+21 -22 replies
2/2selftests/bpf: Add test for narrow loads from context at an offsettools/testing/selftests/bpf/prog_tests/narrow_load.c tools/testing/selftests/bpf/progs/test_narrow_load.c+127 -01 reply

Reviews trailers per patch

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

PatchYonghong Song
1/2A-b
2/2A-b

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

Read the v2 thread

Cover letter [PATCH bpf v2 0/2] Fix narrow loads from an offset outside of target field

This is a second attempt at fixing narrow loads from context fields backed by smaller-in-size target fields, when load offset is beyond the target field.

Following Yonghong suggestion, verifier now emits an 'wX = 0' or 'rX = 0' instruction for loads from offsets outside of target field.

Cc Yonghong Song <[email protected]>

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

Jakub Sitnicki (2):
bpf: Load zeros for narrow loads beyond target field selftests/bpf: Add test for narrow loads from context at an offset

 kernel/bpf/verifier.c                         | 23 ++++-
 .../selftests/bpf/prog_tests/narrow_load.c    | 84 +++++++++++++++++++
 .../selftests/bpf/progs/test_narrow_load.c    | 43 ++++++++++
 3 files changed, 148 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/narrow_load.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_narrow_load.c
Signature · 1 line
2.25.4