Commit 7805264
committed
bpf: fix precision backtracking instruction iteration
jira LE-1907
Rebuild_History Non-Buildable kernel-5.14.0-427.18.1.el9_4
commit-author Andrii Nakryiko <[email protected]>
commit 4bb7ea9
Fix an edge case in __mark_chain_precision() which prematurely stops
backtracking instructions in a state if it happens that state's first
and last instruction indexes are the same. This situations doesn't
necessarily mean that there were no instructions simulated in a state,
but rather that we starting from the instruction, jumped around a bit,
and then ended up at the same instruction before checkpointing or
marking precision.
To distinguish between these two possible situations, we need to consult
jump history. If it's empty or contain a single record "bridging" parent
state and first instruction of processed state, then we indeed
backtracked all instructions in this state. But if history is not empty,
we are definitely not done yet.
Move this logic inside get_prev_insn_idx() to contain it more nicely.
Use -ENOENT return code to denote "we are out of instructions"
situation.
This bug was exposed by verifier_loop1.c's bounded_recursion subtest, once
the next fix in this patch set is applied.
Acked-by: Eduard Zingerman <[email protected]>
Fixes: b5dc016 ("bpf: precise scalar_value tracking")
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
(cherry picked from commit 4bb7ea9)
Signed-off-by: Jonathan Maple <[email protected]>1 parent 600b4a2 commit 7805264
1 file changed
+19
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3199 | 3199 | | |
3200 | 3200 | | |
3201 | 3201 | | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
3202 | 3212 | | |
3203 | 3213 | | |
3204 | 3214 | | |
3205 | 3215 | | |
3206 | 3216 | | |
3207 | 3217 | | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
3208 | 3225 | | |
3209 | 3226 | | |
3210 | 3227 | | |
| |||
4084 | 4101 | | |
4085 | 4102 | | |
4086 | 4103 | | |
4087 | | - | |
4088 | | - | |
4089 | 4104 | | |
4090 | 4105 | | |
| 4106 | + | |
| 4107 | + | |
4091 | 4108 | | |
4092 | 4109 | | |
4093 | 4110 | | |
| |||
0 commit comments