rust icon indicating copy to clipboard operation
rust copied to clipboard

miri genmc: fix exit() handling

Open RalfJung opened this issue 2 months ago • 6 comments

In genmc mode, Miri does not want to stop execution when exit is called. Instead we want to continue running other threads to ensure we covered all possible concurrent behaviors (including the ones where the exiting thread was delayed so the other threads took their turns first). However, the core interpreter has a sanity check that prevents us from just doing nothing in exit. This leaves us in a pickle: there's nowhere we can jump to (exit has return type ! so there's no next block), but if we don't jump anywhere we ICE.

The first commit fixes that by disabling the sanity check when there is no block to jump to. That still catches the mistake of forgetting to jump for the vast majority of shims.

We currently don't build Miri's genmc integration in rustc CI so I had to hack the feature into the bootstrap miri integration. That turned out to use the wrong Miri binary, which is fixed by the second commit: we can just rely on CARGO_BIN_EXE_miri, there's no need for a MIRI environment variable.

r? @oli-obk

RalfJung avatar Nov 16 '25 09:11 RalfJung

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

rustbot avatar Nov 16 '25 09:11 rustbot

oli-obk is not on the review rotation at the moment. They may take a while to respond.

rustbot avatar Nov 16 '25 09:11 rustbot

@oli-obk anything I can do to move this along? :) Or should I find another reviewer?

The core interpreter changes are very small, just slightly weakening a sanity check that is getting in the way.

RalfJung avatar Nov 29 '25 15:11 RalfJung

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

rustbot avatar Nov 29 '25 15:11 rustbot

@saethlin maybe you could take a look at this?

RalfJung avatar Dec 07 '25 08:12 RalfJung

r? saethlin

saethlin avatar Dec 07 '25 09:12 saethlin