fix: classify KVM_RUN failures by whether the timer fired, not was armed - #92
Open
perbu wants to merge 1 commit into
Open
fix: classify KVM_RUN failures by whether the timer fired, not was armed#92perbu wants to merge 1 commit into
perbu wants to merge 1 commit into
Conversation
run_once() tested timer_ticks, which holds the *configured* timeout in ms, so every KVM_RUN failure inside a timed run was thrown as "Timeout Exception" and its errno discarded - an EFAULT from a guest touch of protected or unbacked host memory in particular became indistinguishable from a slow request. Now a timeout requires the timer to have actually fired (the SIGUSR2 handler's thread_local, or EINTR with a timer armed); everything else keeps its errno and routes to the existing EFAULT / generic branches. errno is captured inside the ioctl scope before the profiler's destructor can overwrite it. Genuine timeouts still throw MachineTimeoutException with unchanged message and data. arm64 mirror transcribed from the amd64 shape; not build-verified here (no aarch64 toolchain on this box). Found while testing VmGroup PerGroup guard bands, where the band fault surfaces as -EFAULT from KVM_RUN and the relabel would have been a diagnosability regression. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1 of the ladder in #91. Standalone.
run_once() tested timer_ticks, which holds the configured timeout, so every KVM_RUN failure inside a timed run threw Timeout Exception and discarded errno — a guest EFAULT was indistinguishable from a slow request. A timeout now requires the timer to have actually fired (the SIGUSR2 handler's thread_local, or EINTR with a timer armed); everything else keeps its errno and routes to the existing EFAULT/generic branches. errno is captured inside the ioctl scope, before the profiler destructor can overwrite it.
Same treatment on arm64. Unit suite on x86-64 matches the master baseline; the arm64 side was validated on an Asahi host on the original branch.
🤖 Generated with Claude Code