Skip to content

bpf: permit bpf program narrower loads for ctx fields

Yonghong Song netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: permits narrower load from bpf program context fieldsinclude/linux/bpf.h include/linux/bpf_verifier.h kernel/bpf/verifier.c +3 more+124 -1190 replies
2/2selftests/bpf: Add test cases to test narrower ctx field loadstools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/test_pkt_md_access.c tools/testing/selftests/bpf/test_progs.c +1 more+234 -10 replies

Reviews trailers per patch

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

PatchDaniel Borkmann
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 v1 thread

Cover letter [PATCH 0/2] bpf: permit bpf program narrower loads for ctx fields

Today, if users try to access a ctx field through a narrower load, e.g., __be16 prot = __sk_buff->protocol, verifier will fail.
This set contains the verifier change to permit such loads for certain ctx fields as well as the new test cases in selftests/bpf.

Yonghong Song (2):
bpf: permits narrower load from bpf program context fields selftests/bpf: Add test cases to test narrower ctx field loads

 include/linux/bpf.h                              |   2 +-
 include/linux/bpf_verifier.h                     |   1 +
 kernel/bpf/verifier.c                            |  71 +++++---
 kernel/trace/bpf_trace.c                         |  21 ++-
 net/core/filter.c                                |  56 +++++--
 tools/testing/selftests/bpf/Makefile             |   3 +-
 tools/testing/selftests/bpf/test_pkt_md_access.c |  35 ++++
 tools/testing/selftests/bpf/test_progs.c         |  21 +++
 tools/testing/selftests/bpf/test_verifier.c      | 200 ++++++++++++++++++-----
 9 files changed, 324 insertions(+), 86 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/test_pkt_md_access.c
Signature · 1 line
2.9.3