diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2018-12-13 14:42:31 -0500 |
|---|---|---|
| committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-12-14 19:28:32 -0500 |
| commit | b233920c97a6201eb47fbafd78365c6946e6d7b6 (patch) | |
| tree | b12e159f1af740aea1e6ea95a6944e2341689e09 /kernel/bpf | |
| parent | eb415c98980fd13618c64b0d88c2439103b4a627 (diff) | |
bpf: speed up stacksafe check
Don't check the same stack liveness condition 8 times.
once is enough.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Edward Cree <ecree@solarflare.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf')
| -rw-r--r-- | kernel/bpf/verifier.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index ba8e3134bbc2..0c6deb3f2be4 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
| @@ -5204,9 +5204,11 @@ static bool stacksafe(struct bpf_func_state *old, | |||
| 5204 | for (i = 0; i < old->allocated_stack; i++) { | 5204 | for (i = 0; i < old->allocated_stack; i++) { |
| 5205 | spi = i / BPF_REG_SIZE; | 5205 | spi = i / BPF_REG_SIZE; |
| 5206 | 5206 | ||
| 5207 | if (!(old->stack[spi].spilled_ptr.live & REG_LIVE_READ)) | 5207 | if (!(old->stack[spi].spilled_ptr.live & REG_LIVE_READ)) { |
| 5208 | i += BPF_REG_SIZE - 1; | ||
| 5208 | /* explored state didn't use this */ | 5209 | /* explored state didn't use this */ |
| 5209 | continue; | 5210 | continue; |
| 5211 | } | ||
| 5210 | 5212 | ||
| 5211 | if (old->stack[spi].slot_type[i % BPF_REG_SIZE] == STACK_INVALID) | 5213 | if (old->stack[spi].slot_type[i % BPF_REG_SIZE] == STACK_INVALID) |
| 5212 | continue; | 5214 | continue; |
