OSDN Git Service

bpf: extend is_branch_taken to registers
authorAlexei Starovoitov <ast@kernel.org>
Sat, 15 Jun 2019 19:12:19 +0000 (12:12 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 19 Jun 2019 00:22:51 +0000 (02:22 +0200)
commitfb8d251ee2a6bf4d7f4af5548e9c8f4fb5f90402
tree69e0a487f6b8cdb6847bcaf35180ee62a1a992a2
parentfc559a70d57c6ee5443f7a750858503e94cdc941
bpf: extend is_branch_taken to registers

This patch extends is_branch_taken() logic from JMP+K instructions
to JMP+X instructions.
Conditional branches are often done when src and dst registers
contain known scalars. In such case the verifier can follow
the branch that is going to be taken when program executes.
That speeds up the verification and is essential feature to support
bounded loops.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/verifier.c