hle: a page count past the title's pages is refused, not allocated #576
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!576
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:xmem-page-count-vec"
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: two xmem entry points copy a title-supplied page list into a
Vecsized straight from the title's count, before anything looks at a page:Nothing bounds
n. PR #411 (merged) boundsn * PAGEandbase + leninmap_pages, which still letsnreach 2^48, andXMemFreePhysicalPageshad no check at all. One garbage count asks for terabytes: the refused allocation ishandle_alloc_error, an abort that the run's crash filters do not see, where the console's runtime would have failed the call.This change adds
MOST_PAGES(a page count no real title asks for), refuses a count past it in both entry points — the free keeps the same "nothing freed" answer it already gives,map_pagesreturns the null it already returns for an unknown page — and says so with a warning. The comment inmap_pagesrecords why the count is checked separately from the byte arithmetic.How it was tested
625eca3(one commit onc8258f9).cargo test --locked -p darner-hle --lib— 511 passed, 0 failed, 15 ignored.xmem.rs):a_mapping_page_count_past_the_title_pages_is_refusedanda_free_page_count_past_the_title_pages_is_ignored. They take real physical pages fromXMemAllocatePhysicalPages(no adapter, no title) and passnvalues past the bound.git stash): i.e. the test process is aborted by the allocation the guard now prevents.cargo clippy --locked -p darner-hle --all-targets -- -D warningspasses.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.cargo test --workspace --locked: not run to completion here; the pre-existingdarner-gputest deadlock (#224) anddarner-shaderwaterfall fixture failure (#227) make the whole-workspace run non-green on this machine.darner-hle's suite is green (511 passed).alias_held's overlap test,alias_constant'sto + k * PAGE) are untouched — one change per commit.Checklist
main.main.docs/asset-policy.md. (cargo xtask policy: 576 files ok.)Checked for overlap
crates/darner-hle/src/modules/xmem.rs(view guards / LAZY map / overflow aliases, and dstorage destinations written through their sections); neither mentions the page count orXMemFreePhysicalPages, and this change is confined to the free guard andmap_pages' first lines.[pr-fix][memory] hle: a page count past the title's pages is refused, not allocatedto hle: a page count past the title's pages is refused, not allocatedTest needed — commit
625eca34; what to check:The problem on main: two xmem entry points copy a title-supplied page list into a
Vecsized straight from the title's count, before anything looks at a page:Nothing bounds
n. PR #411 (merged) boundsn * PAGEandbase + leninmap_pages, which still letsnreach 2^48, andXMemFreePhysicalPageshad no check at all. One garbage count asks for terabytes: the refused allocation ishandle_alloc_error, an abort that the run's crash filters do not see, where the console's runtime would have failed the call.This change adds
MOST_PAGES(a page count no real title asks for), refuses a count past it in both entry points — the free keeps the same "nothing freed" answer it already gives,map_pagesreturns the null it already returns for an unknown page — and says so with a warning. The comment inmap_pagesrecords why the count is checked separately from the byte arithmetic.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.