Fix two related issues issues around verifying stack accesses: 1. accesses to uninitialized stack memory was allowed inconsistently 2. the maximum stack depth needed for a program was not always maintained correctly The two issues are fixed together in one commit because the code for one affects the other. The second patch is tests only. It was split for review purposes; it can be squashed when merging if it looks good. Andrei Matei (2): bpf: fix accesses to uninit stack slots bpf: new verifier tests for stack access include/linux/bpf_verifier.h | 4 ++ kernel/bpf/verifier.c | 70 ++++++++----------- .../selftests/bpf/progs/test_global_func16.c | 2 +- .../bpf/progs/verifier_basic_stack.c | 6 +- .../selftests/bpf/progs/verifier_int_ptr.c | 2 +- .../selftests/bpf/progs/verifier_raw_stack.c | 2 +- .../selftests/bpf/progs/verifier_var_off.c | 4 +- tools/testing/selftests/bpf/test_verifier.c | 24 +++++++ .../selftests/bpf/verifier/atomic_cmpxchg.c | 11 --- tools/testing/selftests/bpf/verifier/calls.c | 2 +- tools/testing/selftests/bpf/verifier/stack.c | 40 +++++++++++ 11 files changed, 106 insertions(+), 61 deletions(-) create mode 100644 tools/testing/selftests/bpf/verifier/stack.c -- 2.40.1