Commit cafe2c2
bpf: widening for callback iterators
Callbacks are similar to open coded iterators, so add imprecise
widening logic for callback body processing. This makes callback based
loops behave identically to open coded iterators, e.g. allowing to
verify programs like below:
struct ctx { u32 i; };
int cb(u32 idx, struct ctx* ctx)
{
++ctx->i;
return 0;
}
...
struct ctx ctx = { .i = 0 };
bpf_loop(100, cb, &ctx, 0);
...
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20231121020701.26440-9-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent 958465e commit cafe2c2
1 file changed
+22
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9799 | 9799 | | |
9800 | 9800 | | |
9801 | 9801 | | |
9802 | | - | |
| 9802 | + | |
9803 | 9803 | | |
9804 | 9804 | | |
| 9805 | + | |
9805 | 9806 | | |
9806 | 9807 | | |
9807 | 9808 | | |
| |||
9856 | 9857 | | |
9857 | 9858 | | |
9858 | 9859 | | |
9859 | | - | |
| 9860 | + | |
| 9861 | + | |
9860 | 9862 | | |
9861 | 9863 | | |
9862 | 9864 | | |
| |||
9871 | 9873 | | |
9872 | 9874 | | |
9873 | 9875 | | |
| 9876 | + | |
| 9877 | + | |
| 9878 | + | |
| 9879 | + | |
| 9880 | + | |
| 9881 | + | |
| 9882 | + | |
| 9883 | + | |
| 9884 | + | |
| 9885 | + | |
| 9886 | + | |
| 9887 | + | |
| 9888 | + | |
| 9889 | + | |
| 9890 | + | |
| 9891 | + | |
| 9892 | + | |
| 9893 | + | |
9874 | 9894 | | |
9875 | 9895 | | |
9876 | 9896 | | |
| |||
0 commit comments