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 -- 2.9.3