Repository navigation
Conversation
Only the first byte of the buffer was translated and the rest was accessed at physical + i. A buffer crossing a page boundary is not physically contiguous unless the guest is identity-mapped, so its tail was written into an unrelated physical page. StartInfo now holds (physical address, length) pieces. A size variable that crosses into a non-contiguous page is rejected at start. Fixes intel#487
The size read from the guest was used without an upper bound. With an uninitialized size variable TSFFS read guest memory byte by byte until a read failed, then reported that address instead of the bad size. The error now names the size and the register or pointer it came from. Fixes intel#488
Wenzel
force-pushed
the
fix/start-size-upper-bound-488
branch
from
November 24, 2026 21:38
d4e9b68 to
f04665f
Compare
This branch has not been deployed
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.
Summary
The size read from the guest at the start harness was used without an upper bound. With an uninitialized size variable, TSFFS read guest memory byte by byte until a read failed, then reported that address instead of the bad size.
The check is in the helper shared by the three magic start variants and the manual start.
One integration test,
x86_64_magic_size_unbounded_latest, with a new targettests/rsrc/x86_64-uefi/test-size-uninit.c.Stacked on #507: the first commit is that PR, as the check lives in the helper it introduces. Only the last commit is new here.
Fixes #488
Evidence
The target passes
size = 0x7ffe12345678toHARNESS_START(buffer, &size). Linux, QSP x86-64:main(ed67e1c)Failed to read byte at 0xf1000004: SimExc_General: Exception 1031 from qsp.mb.cpu0.mem[0][0], test takes 80 s (test FAILED)Testcase size 0x7ffe12345678 from the size variable at 0xdf2c1280 (register rdx) is larger than the maximum 0x40000000, is the size initialized?, test takes 31 s (test ok)Failed to read byteerrorTestcase size 0x7ffe12345678 ...errorOn this QSP the unbounded read did not hang: it ran into a device region after about 300 MB. How far it gets depends on the memory map of the target.
On Simics 7 the test runs through
cargo test. On Simics 6 the same test script was run by hand in a project with the module built withSIMICS_BASE=simics-6.0.185, as the test harness here only knows the Simics 7 install.x86_64_magic_page_cross_latestfrom the parent PR also passes on this branch on Simics 6.On this branch: lib unit tests 48 passed, 1 ignored.
cargo clippy -ris clean.Not run: the manual start path, the magic start variants that take the size in a register, the rest of the integration suite.
Merge Danger
Door: two-way
Blast Radius: contained
A harness that asks for a testcase buffer above 1 GiB is now refused. The limit is the constant
MAXIMUM_TESTCASE_SIZE.🤖 Generated with Claude Code