diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-12-20 09:13:06 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-12-20 19:28:28 +0300 |
commit | 9b38c4056b2736bb5902e8b0911832db666fd19b (patch) | |
tree | cfff837fa66417ec29826eaded7813cf98724567 /kernel/bpf/verifier.c | |
parent | 14507e35bd9dedcd14c24f9e5e0e0dd48e972e53 (diff) | |
download | linux-9b38c4056b2736bb5902e8b0911832db666fd19b.tar.xz |
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/verifier.c')
-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 */ |