loader: a clzero on free memory is left to the title #642
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!642
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:clzero-legacy-claim"
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?
Contributor role (optional)
What it changes
The problem on main: the vectored handler asks the console-only instruction emulation first and, when it answers zero, falls through to the legacy
emulate_amd_only. That zero means two different things — "not a console-only instruction" and "this one is the title's": aclzerowhose line has nothing mapped at it, whichconsole_insn'szero_through_faultdeclines so that the exception stays the title's. The0f 01 fcarm then claimed the same fault, andclzero's first act is a blind 64-byte store into the lineraxnames: on free memory that store faults inside the vectored handler, at our own RIP, and the re-entered handler reports that fault instead of the instruction the title faulted on, whose own handlers never see it.This change makes
clzeroask the questionzero_through_faultasks — is the line committed or reserved — and return false when nothing is mapped there, so the handler goes on toEXCEPTION_CONTINUE_SEARCHand the fault is left where the newer emulation meant it to be. Only the legacy paths ask it; everyclzerothe newer emulation handles returns before this one.How it was tested
f0fae20(one commit onc8258f9).cargo test --locked -p darner-loader --lib -- crash— 25 passed, 0 failed.clzeroand the 12-byte loop whose first line is that one are both refused. Fail-before, with the refusal taken out, the test's own store faults the test process (0xc0000005) — the defect itself, reproduced.cargo clippy --locked -p darner-loader --all-targets -- -D warningspasses.clzeroon a mapped line is emulated exactly as before; one on free memory is left to the title, which is what the newer emulation already decided.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.darner-loader's suite is green (25 crash tests among it); the whole-workspace run is not green on this machine for the pre-existingdarner-gpureasons (#224, #150), which this does not touch.clzeroon a page it then frees while the exception is pending; the test supplies that state directly.0f 01 fcsingle and the 12-byte loop shape are pinned; the otherclzeroforms in that report are untouched.Checklist
main.docs/asset-policy.md(cargo xtask policy: passes).Checked for overlap
crates/darner-loader/src/crash.rs; this change adds to the same file'sclzeropath only. The sibling fix for the loop recogniser (#593, mine, open) touchesconsole_insn_decode.rs, not this file.[pr-fix][startup] loader: a clzero on free memory is left to the titleto loader: a clzero on free memory is left to the titleTest needed — commit
f0fae208; what to check:The problem on main: the vectored handler asks the console-only instruction emulation first and, when it answers zero, falls through to the legacy
emulate_amd_only. That zero means two different things — "not a console-only instruction" and "this one is the title's": aclzerowhose line has nothing mapped at it, whichconsole_insn'szero_through_faultdeclines so that the exception stays the title's. The0f 01 fcarm then claimed the same fault, andclzero's first act is a blind 64-byte store into the lineraxnames: on free memory that store faults inside the vectored handler, at our own RIP, and the re-entered handler reports that fault instead of the instruction the title faulted on, whose own handlers never see it.This change makes
clzeroask the questionzero_through_faultasks — is the line committed or reserved — and return false when nothing is mapped there, so the handler goes on toEXCEPTION_CONTINUE_SEARCHand the fault is left where the newer emulation meant it to be. Only the legacy paths ask it; everyclzerothe newer emulation handles returns before this one.Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.
Reply
testingto take this run; it's free again after 24 h with no results.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.