Commit 0b5028e
Add timeout to prevent verifier hang on malformed programs (#763)
* Add timeout mechanism to prevent verifier infinite loops
Add a 5-second timeout around prevail::analyze() to prevent the fuzzer
from hanging on malformed BPF programs that cause the verifier to enter
infinite loops (e.g., nested loops which are a known limitation of prevail).
The timeout uses a separate thread with std::future::wait_for() to detect
when verification takes too long. If the timeout is reached, the verification
thread is detached and the function returns false (verification failed).
This fix addresses CI failures where the fuzzer would timeout after 60+
seconds on programs that trigger verifier infinite loops.
Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
* Update documentation with implementation notes
Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
* Revert "Update documentation with implementation notes"
This reverts commit e1c27a1.
* Move verification state to heap to fix use-after-free on timeout
Address review feedback:
- Move all shared state (program, result, promise, completion flag) to
heap-allocated shared_ptrs so detached thread cannot access destroyed
stack locals on timeout.
- Add safe_set_value wrapper to guard against set_value throwing when
promise is already satisfied or has no state.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 026ec21 commit 0b5028e
1 file changed
Lines changed: 57 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
384 | 387 | | |
385 | 388 | | |
386 | 389 | | |
387 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
388 | 441 | | |
389 | | - | |
390 | | - | |
391 | | - | |
| 442 | + | |
392 | 443 | | |
393 | 444 | | |
394 | 445 | | |
395 | | - | |
| 446 | + | |
396 | 447 | | |
397 | 448 | | |
398 | 449 | | |
399 | | - | |
| 450 | + | |
400 | 451 | | |
401 | 452 | | |
402 | 453 | | |
| |||
0 commit comments