Re: [BUG] verifier escape with iteration helpers (bpf_loop, ...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 3, 2023 at 7:57 PM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> ok. discard that idea.

Attached is a 3rd version of the same idea I argued earlier.
Let normal DFS go as normal,
do states_equal() on V which has 1 looping branch remain
and all other explored.
To achieve that when iter_next() is seen do parent->looping_states += 2;

then when processing any children do parent->looping_states++;
in the correct parent.
Since there could be many intermediate states have to walk back
parentage chain to increment correct parent.
When the state reaches bpf_exit or safety, walk back
the parentage chain and do looping_states--.
The state is ok to use in states_equal() if looping_states==1.

With this patch all existing iter tests still pass,
and all Ed's special tests pass or fail as needed.
Ex: loop_state_deps1 is rejected with misaligned stack,
loop1 loads with success, num_iter_bug fails with bad pointer.

Please review.
I could be just lucky with the way tests are constructed,
but I feel this is a better path to fix this issue instead
of DFS/BFS combo that I have doubts about.

Attachment: 0001-iter-hack-3.patch
Description: Binary data


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux