diff options
author | Jakub Kicinski | 2019-01-23 07:45:20 +0100 |
---|---|---|
committer | Alexei Starovoitov | 2019-01-24 02:35:31 +0100 |
commit | 52875a04f4b26e7ef30a288ea096f7cfec0e93cd (patch) | |
tree | ef2b72219c9eae090adb9a35d75bc64b2b9ed50c /include/linux/filter.h | |
parent | bpf: verifier: hard wire branches to dead code (diff) | |
download | kernel-qcow2-linux-52875a04f4b26e7ef30a288ea096f7cfec0e93cd.tar.gz kernel-qcow2-linux-52875a04f4b26e7ef30a288ea096f7cfec0e93cd.tar.xz kernel-qcow2-linux-52875a04f4b26e7ef30a288ea096f7cfec0e93cd.zip |
bpf: verifier: remove dead code
Instead of overwriting dead code with jmp -1 instructions
remove it completely for root. Adjust verifier state and
line info appropriately.
v2:
- adjust func_info (Alexei);
- make sure first instruction retains line info (Alexei).
v4: (Yonghong)
- remove unnecessary if (!insn to remove) checks;
- always keep last line info if first live instruction lacks one.
v5: (Martin Lau)
- improve and clarify comments.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/filter.h')
-rw-r--r-- | include/linux/filter.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index ad106d845b22..be9af6b4a9e4 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -778,6 +778,7 @@ static inline bool bpf_dump_raw_ok(void) struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, const struct bpf_insn *patch, u32 len); +int bpf_remove_insns(struct bpf_prog *prog, u32 off, u32 cnt); void bpf_clear_redirect_map(struct bpf_map *map); |