Currently, for all helpers with integer return type, the verifier permits a single return type, RET_INTEGER, which represents 64-bit return value from the helper, and the verifier will assign 64-bit value ranges for these return values. Such an assumption is different from what compiler sees and the generated code with llvm alu32 mode, and may lead verification failure. This patch enhanced verifier to handle s32/u32 helper return values properly to avoid verification failure due to conservative return value range marking. Patch #1 commit message has details of explanation and Patch #2 added test cases to selftests test_verifier. Yonghong Song (2): [bpf] allow s32/u32 return types in verifier for bpf helpers [tools/bpf] add verifier test for s32/u32 helper return values include/linux/bpf.h | 4 +- kernel/bpf/helpers.c | 8 +-- kernel/bpf/verifier.c | 30 +++++++++-- kernel/trace/bpf_trace.c | 4 +- net/core/filter.c | 16 +++--- .../selftests/bpf/verifier/helper_ret.c | 50 +++++++++++++++++++ 6 files changed, 94 insertions(+), 18 deletions(-) create mode 100644 tools/testing/selftests/bpf/verifier/helper_ret.c -- 2.17.1