diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-12-20 07:13:06 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-12-20 17:28:28 +0100 |
commit | 9b38c4056b2736bb5902e8b0911832db666fd19b (patch) | |
tree | cfff837fa66417ec29826eaded7813cf98724567 /kernel/bpf | |
parent | selftests: bpf: verifier: add tests for JSET interpretation (diff) | |
download | linux-9b38c4056b2736bb5902e8b0911832db666fd19b.tar.xz linux-9b38c4056b2736bb5902e8b0911832db666fd19b.zip |
bpf: verifier: reorder stack size check with dead code sanitization
Reorder the calls to check_max_stack_depth() and sanitize_dead_code()
to separate functions which can rewrite instructions from pure checks.
No functional changes.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/verifier.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 98ed27bbd045..d27d5a880015 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -6983,10 +6983,11 @@ skip_full_check: free_states(env); if (ret == 0) - sanitize_dead_code(env); + ret = check_max_stack_depth(env); + /* instruction rewrites happen after this point */ if (ret == 0) - ret = check_max_stack_depth(env); + sanitize_dead_code(env); if (ret == 0) /* program is valid, convert *(u32*)(ctx + off) accesses */ |