Re: [Bug Report] bpf: incorrectly pruning runtime execution path

From: Eduard Zingerman
Date: Thu Dec 14 2023 - 20:43:47 EST


On Fri, 2023-12-15 at 03:24 +0200, Eduard Zingerman wrote:
[...]
> Here is an option that would fix the test in question, but I'm not
> sure if it covers all cases:
> 1. At the last instruction of each state (first instruction to be
> backtracked) we know the set of IDs that should be tracked for
> precision, as currently marked by mark_precise_scalar_ids().
> 2. In jump history we can record IDs for src and dst registers when new
> entry is pushed.
> 3. While backtracking 'if' statement, if one of the recorded IDs is in
> the set identified at (1), add src/dst regs to precise registers set.

Nah... this won't work for "second order" ids.

--- suppose r2.id == r3.id here
if r3 > 10 goto exit;
r1 += r2
... use r1 as precise ...