Commit 3feb263
bpf: handle ldimm64 properly in check_cfg()
ldimm64 instructions are 16-byte long, and so have to be handled
appropriately in check_cfg(), just like the rest of BPF verifier does.
This has implications in three places:
- when determining next instruction for non-jump instructions;
- when determining next instruction for callback address ldimm64
instructions (in visit_func_call_insn());
- when checking for unreachable instructions, where second half of
ldimm64 is expected to be unreachable;
We take this also as an opportunity to report jump into the middle of
ldimm64. And adjust few test_verifier tests accordingly.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Reported-by: Hao Sun <sunhao.th@gmail.com>
Fixes: 475fb78 ("bpf: verifier (add branch/goto checks)")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20231110002638.4168352-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent fe69a1b commit 3feb263
3 files changed
Lines changed: 30 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
912 | 917 | | |
913 | 918 | | |
914 | | - | |
915 | | - | |
| 919 | + | |
916 | 920 | | |
917 | 921 | | |
918 | 922 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15439 | 15439 | | |
15440 | 15440 | | |
15441 | 15441 | | |
15442 | | - | |
| 15442 | + | |
15443 | 15443 | | |
15444 | | - | |
| 15444 | + | |
| 15445 | + | |
15445 | 15446 | | |
15446 | 15447 | | |
15447 | 15448 | | |
15448 | | - | |
| 15449 | + | |
15449 | 15450 | | |
15450 | | - | |
| 15451 | + | |
15451 | 15452 | | |
15452 | 15453 | | |
15453 | 15454 | | |
| |||
15469 | 15470 | | |
15470 | 15471 | | |
15471 | 15472 | | |
15472 | | - | |
| 15473 | + | |
15473 | 15474 | | |
15474 | 15475 | | |
15475 | 15476 | | |
15476 | 15477 | | |
15477 | 15478 | | |
15478 | 15479 | | |
15479 | | - | |
15480 | | - | |
| 15480 | + | |
| 15481 | + | |
| 15482 | + | |
| 15483 | + | |
15481 | 15484 | | |
15482 | 15485 | | |
15483 | 15486 | | |
| |||
15607 | 15610 | | |
15608 | 15611 | | |
15609 | 15612 | | |
| 15613 | + | |
| 15614 | + | |
15610 | 15615 | | |
15611 | 15616 | | |
15612 | 15617 | | |
15613 | 15618 | | |
15614 | 15619 | | |
| 15620 | + | |
| 15621 | + | |
| 15622 | + | |
| 15623 | + | |
| 15624 | + | |
| 15625 | + | |
| 15626 | + | |
| 15627 | + | |
15615 | 15628 | | |
15616 | 15629 | | |
15617 | 15630 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
0 commit comments