runtime validate ApuAlloc outputs #2495
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2495
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2495/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@KelboLive on GitHub · 2026-11-25 18:37 UTC · original
KelboLive:pr/1902-apualloc→main· +126 −24 · 3 files · 1 commits · closed without mergingAdds runtime validation of ApuAlloc outputs with a new fixture test.
Files:
Run: Test project D:/Kelbo AI Dashboard Projects/Xbox2Windows/out/build/dev
Start 112: startup_acphal_apu_free
1/1 Test #112: startup_acphal_apu_free .......... Passed 0.16 sec
100% tests passed out of 1
Total Test time (real) = 0.20 sec
@ChazY11 on GitHub · 2026-11-25 19:15 UTC · original
Built and run here: both AcpHal cases pass — one of three mutations caught, and the two survivors name the inputs that are missing
startup_acphal_apu_freeandcpu_native_acphal_halboth pass on this branch, together with their prerequisites(
cpu_acphal_hal_caller,cpu_acphal_hal_provider,cpu_acphal_hal_provider_faulty,cpu_exe_io,pe_map):Worth recording for anyone else reproducing this:
cpu_native_acphal_halfails withFileNotFoundErroroncpu_acphal_hal_provider_faultyunless that target andcpu_exe_io/pe_mapare built too — the failure is a missingartifact, not a defect. I hit it once before building them.
Three mutations of the new range logic
src/startup_stubs/acphal.cpplimit = bytes > 0x100000000ull ? … : bytes→bytes)if (!base || limit <= heap_start || …)if (heap_base && address >= base + heap_start && …)→if (false))The caught one is the important half:
startup_acphal_apu_freereally does assert that a pointer outside the APUrange is rejected on free, so the new validation is load-bearing for the case the fixture builds.
The two survivors are unexercised inputs, not defects
(the churn loop hands out 64 MiB over 30 times). Any heap under 4 GiB takes the same branch either way.
!base. Observable only for a free/validate call made before any heap exists. The fixture always allocatesfirst, so
baseis non-null in every path it takes.Both are cheap to pin if you want them covered: a call to the free entry point before the first allocation (expect the
invalid-argument failure, and no crash), and a heap configured above 4 GiB whose first byte past 4 GiB must be rejected
while the byte below it is accepted. The second one may be the reason the clamp exists at all, so it is the one I would
add a case for.
Environment
Windows 11 build 26300.9974, targets built individually with
cmake --build --preset dev --target …(the full targetset does stop in DXC on this host, these do not). Each mutation was built, run, then reverted and rebuilt; the final
state is green.
AI-assisted.
Pull request closed