Skip to content

Disallow MSR read/writes#991

Draft
ludfjig wants to merge 3 commits into
hyperlight-dev:mainfrom
ludfjig:reset2
Draft

Disallow MSR read/writes#991
ludfjig wants to merge 3 commits into
hyperlight-dev:mainfrom
ludfjig:reset2

Conversation

@ludfjig

@ludfjig ludfjig commented Oct 27, 2025

Copy link
Copy Markdown
Contributor

Disallows reading/writing MSRs in the guest. The goal is to prevent guest state to persist across snapshot-restores.

Will mark ready for review once KVM releases new version, which should include newly added KVM_X86_SET_MSR_FILTER vm ioctl that this PR depends on, see rust-vmm/kvm#359

@ludfjig ludfjig force-pushed the reset2 branch 7 times, most recently from aeca04d to 968f2f4 Compare October 31, 2025 00:29
@ludfjig ludfjig added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Dec 2, 2025
@ludfjig ludfjig force-pushed the reset2 branch 3 times, most recently from e859ff9 to e793129 Compare December 8, 2025 18:42
@ludfjig ludfjig changed the title Reset more state when restoring snapshot Reset MSRs when restoring snapshot Dec 18, 2025
@ludfjig ludfjig changed the title Reset MSRs when restoring snapshot Disallow MSR read/writes Feb 10, 2026
@ludfjig ludfjig force-pushed the reset2 branch 5 times, most recently from 8f55249 to 3bb2294 Compare February 13, 2026 23:16
@ludfjig ludfjig force-pushed the reset2 branch 2 times, most recently from 032168d to c0383dd Compare February 18, 2026 19:27
@ludfjig ludfjig force-pushed the reset2 branch 6 times, most recently from 2e98073 to 089227c Compare July 11, 2026 07:10
@ludfjig ludfjig force-pushed the reset2 branch 6 times, most recently from 444a5eb to d98fa0d Compare July 13, 2026 20:14
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
ludfjig added 2 commits July 13, 2026 16:15
Add an MSHV-only probe that checks whether a host write of HV_X64_REGISTER_TSC resets a guest-shifted TSC, deciding if the raw-TSC leak can be closed by reset. Broaden the test-only MSR helpers to MSHV.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Reset the raw TSC (0x10) on every backend. Hyper-V models TSC and
TSC_ADJUST as independent registers, so a guest WRMSR(TSC) is not
folded into TSC_ADJUST and resetting TSC_ADJUST alone leaves the shift
in place. Deny is not possible on the filterless backends because
Hyper-V refuses a root MSR intercept for an implemented MSR, so reset
is the only lever.

Add TSC to the KVM reset core too, purely for cross-backend
consistency, so a restore rewinds the guest clock uniformly. The KVM
filter still denies guest TSC writes, so nothing leaks there.

Document the full rationale in docs/msr.md.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant