Skip to content

Commit 2ed1cd8

Browse files
authored
Fix getMemSlotDependencies recursive call guard (#76)
In 2d07fba a guard against infinite recursion was added for cases when dependency index equals to selected idx. This turns out to be too conservative, blocking propagation for simple cases like: r7 += 150 r2 = r7 # dependency tree would stop here r3 = r2 Fix this by checking the target memSlotId as well in the guard.
1 parent 58d0dbd commit 2ed1cd8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/analyzer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,10 @@ export function getMemSlotDependencies(
415415

416416
deps = getMemSlotDependencies(verifierLogState, prevDepIdx, memSlotId);
417417
}
418-
} else if (nReads === 1 && depIdx !== bpfState.idx) {
418+
} else if (
419+
nReads === 1 &&
420+
(depIdx !== bpfState.idx || depIns.reads[0] !== memSlotId)
421+
) {
419422
deps = getMemSlotDependencies(verifierLogState, depIdx, depIns.reads[0]);
420423
}
421424

0 commit comments

Comments
 (0)