Repository navigation
v0.10.0
Rewind VM 0.10.0 is about runs that replay differently. The monitor now takes the VM's performance counters away, which a guest could read host cycle counts from, and rewind check blamed what they changed on a schedule. rewind replay compares the whole machine at each keyframe as well as the events, rewind replay --bisect names the first instruction whose result differs between two replays, and the new rewind bugreport gathers what an issue about such a run needs. rewind's output is now in color.
Before you upgrade
- The guest boots without counters, so every run takes different steps than it did with 0.9.0, and the same seed or schedule may fail another way. The guest's init is new too, so run ids change.
- Runs recorded with 0.9.0 or earlier do not replay: their guest kernel set up counters that are no longer there.
rewind replaysays which build recorded such a run and which build is replaying it. Replay them with the build that recorded them, or record them again. - On Linux 6.2 and later KVM is asked to give the VM no counters. An older kernel cannot be asked, so rewind refuses to start a VM there unless kvm is loaded with
enable_pmu=0. A host whose KVM gives VMs no counters at all, such as GitHub's runners, needs nothing. - The manifest, trace and keyframe formats are 0.9.0's.
Performance counters
- KVM gave every VM the host's performance counters whatever CPUID said, four of them on AMD, and they counted the host's cycles. A guest reading them, as a performance test does through
perf_event_open, read a number no input of the run decides, and a replay of that run went another way.rewind checkthen reported a schedule as deciding a failure the counters decided. The monitor's own counters, which count the guest from the host, are not the VM's and stay. - A new flake check,
determinism-sources, records and replays a probe for each way a guest could read the host past the monitor: the counters throughperf_event_open, the in-use bitsxgetbvreads, the results x86 leaves undefined (MUL's flags, BSF and BSR on zero, RCPPS and RSQRTPS), andrdrand. Each replays exactly exceptrdrand, below.
Replaying the whole machine
rewind replaycompares, at each keyframe, the vCPU's registers, vector registers included, its MSRs, the local APIC and a hash of every page of memory with the keyframe the recording took, as well as the events and the read and write records. A machine that differs is named with the registers that differ and the pages, each by the process and symbol it belongs to, or the kernel's. On GNU hello, 140,525 steps and 82 keyframes, the comparison took a replay from 17.1 s to 19.4 s.--machine lastcompares at the last keyframe only, in 17.6 s, and--machine nonecompares events and records alone.- The registers and MSRs the host owns are not compared: the TSC, Hyper-V's reference time and TSC frequency, the APIC timer's current count, the counter MSRs, and an exception or interrupt vector nothing is about to deliver. Each was found as a false difference.
- A run whose machine differed is marked, and
cat,shell,gdbandwhereat a step between the last keyframe that matched and the one that differed warn that what they show there may be values the recording never had. - A run recorded on a Ryzen 7 7840U (Zen 4, Linux 7.1) replayed on an EPYC 7763 (Zen 3, Linux 6.18) with the whole machine identical at every keyframe, GNU hello's included. Intel hosts are not yet verified.
Finding the instruction
rewind replay --bisectrestores two fresh replays at the last keyframe that matched and runs them side by side, compared after every step, then single-steps the step where they part and compares registers after each instruction. It names the instruction, the process and the source line, and for the instructions that read the host (rdrand,rdseed,rdtsc,rdtscp,rdpmc,rdmsr,cpuid,xgetbv,rdpid) says what it reads and why its result can differ. On a probe that draws a number withrdrandand never uses it, whose events replay identically and whose memory does not, it foundrdrand raxinmain, instruction 4072 of step 302, in about 5 s.--tries Nretries for a source that differs only sometimes.- User-space
rdrandandrdseedare the one known gap. CPUID hides them, but on AMD the CPU runs them anyway and KVM does not let the monitor trap them, so a program that executes them without checking CPUID does not replay. Hardly any program does. On Intel KVM is reported to fault them, so the program dies of SIGILL; this is not yet verified on an Intel host. - When a run ends differently from schedule 0,
rewind checkreplays both runs before it narrows anything. If either does not replay exactly, check stops and says no schedule decides the difference, rather than naming a step. - When a replay differs under the build that recorded the run, rewind says the run is not deterministic on this host and points at
--bisectandrewind bugreport. Under another build, which the manifest names, it names both builds and points at the one that recorded the run, since either the run or the builds may be the cause.
rewind bugreport
rewind bugreport RUNwrites a directory withreport.mdand prints a link that opens a GitHub issue filled in with it. The report names this build, the host's CPU, microcode, kernel and the KVM parameters that change what a VM sees, and whatrewind doctorandrewind replayfind. Paths under rewind's home and your home directory are written as$REWIND_HOMEand~.- Beside it is the run's trace-only
.rwd, a few kilobytes, with its command, environment, events and output, to attach.--replayablealso writes the export another machine can replay, tens of megabytes or more, past the 25 MB an issue takes, for when a maintainer asks.--no-runleaves the run out,--bisectincludes whatreplay --bisectfinds, and--openopens the issue in the browser. rewind uploads nothing.
Color
- rewind paints what it compares: green where two things are the same, red where they differ, amber for the left run or the recording and blue for the right run or the replay, as the app's Compare view does. Its own
rewind:prefix is dim. This coversreplay,check,fork,nix,diff,blame,lsanddoctor; JSON and the job's own output stay plain. --color auto|always|never, orREWIND_COLOR, decides it.autocolors a stream that is a terminal and honorsNO_COLOR,CLICOLOR_FORCEandTERM=dumb.rewind gdbturns gdb's styling on when it colors its own output, so a scriptedrewind gdb -- -batchis colored like the rest.- The site's tutorials and case studies show rewind's output in the colors a terminal shows.
Examples and docs
- The three case studies are recorded again by the tutorials' recorder, at a fixed
--epoch, so their commands make the runs the pages show on any day. The numbers changed with the counters: gc-closure fails on schedules 0 and 64, the schema migration hang is shown on schedule 174, and devenv fails 223 of 257 schedules. Their recordings in the case-studies release and the viewer are replaced. - Every tutorial and the app's examples are recorded again with this release. The mylib crash is now decided at step 4758.
- The design notes describe the machine comparison,
--bisectandbugreport. - The bugs page lists go.dev/issue/72981, a skipped HTTP/2 transport test Rewind reproduced, with its fix mailed as CL 852805.
Fixes
- Fuzz targets for the trace, keyframe, manifest, ELF and guest-answer readers found four bugs, each now fixed with a unit test: out-of-range values in read and write records decoded to their low bits or overflowed, a corrupt ELF file could ask for up to 2^64 bytes and abort, a guest answer with a length near
usize::MAXwrapped, and an initramfs larger than RAM computed an address near 2^64. - A job root or mount argument with a NUL byte fails the job with an error instead of panicking the guest's init.
- In a recorded command such as
rewind check github:fzakaria/rewindvm#mylib | grep passing:, the tutorials' recorder read the#as a comment and missed the pipe. checkwrites "an 80 µs pause", where it wrote "a 80 µs pause".- The engine and the guest's init are linted with clippy in their package builds.
Full Changelog: v0.9.0...v0.10.0