cloudflare/cbpfc

Missing indirect packet guards

arthurfabre opened this issue · 0 comments

Under some conditions we don't emit a packet guard.

requiredGuard func(insns []instruction) (int, packetGuard) determines what packet guards a block needs, and how many instructions of insns this guard would cover: indirect guards are invalidated by writing to RegX.

But this doesn't allow us to differentiate between a guard that covers all of insns as is still valid afterwards and a guard that also covers all of insns but is not valid afterwards (because the last instruction in insns writes to RegX). This would lead us to think a guard is still valid when it isn't.

Found by fuzzing.