You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should we add fuel/epoch checks into the middle of {array,memory,table}.{fill,copy,init}? #13387
These cannot lead to infinite loops since they are still bounded, and therefore are not DoS CVEs, but they could block for longer than usual and lead to spiky latencies.1
FWIW, we needn't necessarily add checks on every byte copied in a memory.copy, which would impose horrendous overheads. What we could do to address this instead is have a max size on the chunk of data we are processing all at once without interruption checks and then effectively emit code like
for chunk in block.chunks(MAX_CHUNK_SIZE) {
check();
process(chunk); // <--- the current hot loop or memmove/memcopy libcall
}
#13382 introduced checks for some of the array operations, but IIUC not all of them and also for the ones it does it inserts epoch checks on every loop iteration, rather than doing the chunking suggested above. I think array.new and its ilk are still not checked, but I haven't verified that.
Footnotes
"No spiky latencies" is not something we provide guarantees around already, since we only insert checks at loop headers and function calls, so e.g. large basic blocks without those things can have similar behavior. ↩
Activity
alexcrichton commentedon May 15, 2026
IMO "yes", and I've got a PR for this after #13382
alexcrichton commentedon May 15, 2026
A checklist of instructions to handle:
memory.copyInsert fuel/epoch checks in bulk copies/fills #13393memory.fillInsert fuel/epoch checks in bulk copies/fills #13393memory.initReimplement passive data segments #13394table.copyMovetable.copyimplementation to compiled code #13407table.fillReimplementtable.{grow,fill}#13424table.growReimplementtable.{grow,fill}#13424table.initProcess passive element segments in compiled code #13444array.copyInsert fuel/epoch checks in bulk copies/fills #13393array.fillInsert fuel/epoch checks in bulk copies/fills #13393array.new_dataReimplement passive data segments #13394array.init_dataReimplement passive data segments #13394array.new_elemProcess passive element segments in compiled code #13444array.init_elemProcess passive element segments in compiled code #13444array.new_defaultInsert fuel/epoch checks in bulk copies/fills #13393array.newInsert fuel/epoch checks in bulk copies/fills #13393Reimplement passive data segments
Move `table.copy` implementation to compiled code
Process passive element segments in compiled code
Insert fuel/epoch checks in bulk copies/fills (bytecodealliance#13393)
Reimplement passive data segments
Reimplement passive data segments
Move `table.copy` implementation to compiled code
Reimplement `table.{grow,fill}`
Process passive element segments in compiled code
Reimplement passive data segments
Move `table.copy` implementation to compiled code
Reimplement passive data segments (bytecodealliance#13394)
Move `table.copy` implementation to compiled code
Move `table.copy` implementation to compiled code (#13407)
Reimplement `table.{grow,fill}`
Process passive element segments in compiled code
Reimplement `table.{grow,fill}` (bytecodealliance#13424)
Process passive element segments in compiled code
Process passive element segments in compiled code (bytecodealliance#1…
Test/adjust fuel consumption in bulk ops
Test/adjust fuel consumption in bulk ops (bytecodealliance#13448)