diff options
| author | bors <bors@rust-lang.org> | 2018-07-11 16:24:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-11 16:24:46 +0000 |
| commit | d573fe17786b9c2f5a766498d411d54eee5fa19f (patch) | |
| tree | 03d5b85004a849dff84569e88063e24b4826f8f2 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 66787e05242d86e0bcfa227265559330c45cdc42 (diff) | |
| parent | cf5eaa75bb171f00d6baa475333b741b86f93f72 (diff) | |
| download | rust-d573fe17786b9c2f5a766498d411d54eee5fa19f.tar.gz rust-d573fe17786b9c2f5a766498d411d54eee5fa19f.zip | |
Auto merge of #51702 - ecstatic-morse:infinite-loop-detection, r=oli-obk
Infinite loop detection for const evaluation Resolves #50637. An `EvalContext` stores the transient state (stack, heap, etc.) of the MIRI virtual machine while it executing code. As long as MIRI only executes pure functions, we can detect if a program is in a state where it will never terminate by periodically taking a "snapshot" of this transient state and comparing it to previous ones. If any two states are exactly equal, the machine must be in an infinite loop. Instead of fully cloning a snapshot every time the detector is run, we store a snapshot's hash. Only when a hash collision occurs do we fully clone the interpreter state. Future snapshots which cause a collision will be compared against this clone, causing the interpreter to abort if they are equal. At the moment, snapshots are not taken until MIRI has progressed a certain amount. After this threshold, snapshots are taken every `DETECTOR_SNAPSHOT_PERIOD` steps. This means that an infinite loop with period `P` will be detected after a maximum of `2 * P * DETECTOR_SNAPSHOT_PERIOD` interpreter steps. The factor of 2 arises because we only clone a snapshot after it causes a hash collision.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
