[pr-fix] pe: import-library members that are not AMD64 are refused #407
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!407
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:implib-machine-check"
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:
crates/darner-pe/src/implib.rsfeeds every archive member toobject's short-format import reader and keeps whatever comes back, without ever reading the header's machine field:(
implib.rs:43-55).object0.41.0 exposes that field asImportFile::architecture()(object-0.41.0/src/read/coff/import.rs:70-78); nothing read it. A member from the SDK'sum\x86orum\arm64therefore parsed as if it were the console's export map, and its decorated names landed beside the real ones with nothing to tell them apart. On the PE path the same crate already refuses a foreign machine (image.rs:139-143,machine != MACHINE_AMD64), so this was the one reader in the crate that did not.This change refuses a member whose architecture is not x86-64, failing the library with
PeError::Unsupported("import library member for I386 is not AMD64")— the same variant and the same shape of message the image path uses. The accepting arm is untouched; the diff is additions only.How it was tested
8182918(one commit onf3840d7).cargo test --locked -p darner-pe --lib— 37 passed, 0 failed.implib::tests::an_import_object_of_another_machine_is_refused: it builds the existing synthetic archive with one AMD64ExitProcessmember and one member whose machine field is rewritten toIMAGE_FILE_MACHINE_I386(0x014c) and which holds_ExitProcess@4, then asserts the parse isErr(PeError::Unsupported(..))and that the message namesI386._ExitProcess@4besideExitProcessis exactly the duplicate the finding measured against a realum\x86\MSTask.Lib.cargo clippy --locked -p darner-pe --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 green on this machine, and not because of this change. Three pre-existing failures, each covered by an open pull request:darner-gpustands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (pipeline::make::tests::a_capped_draw_waits_once_then_drops, which passes on its own) beside the order-dependentwatch::tests::ask_once_by_res_splits_reservations_without_refusalsandtexture::ahead::tests::drain_waits_until_then_callbacks_have_runflakes of #150;darner-shaderfailsemit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, whose fixture #227 fixes.darner-pe's own suite is green (37 passed).darner lib-exportsand the loader's import-library analysis; it never runs while the title runs.Unknowngo through the same singlearchitecture()comparison and are untested but code-identical. The CLI path (apps/darner/src/inspect.rs,lib_exports) has no test and none was added — the change is indarner-pe. The test writes the machine field at its header offset rather than throughobject; a wrong offset would fail the assertion loudly rather than pass silently.Checklist
darner lib-exports/censustools, not a runtime path. The evidence is the new test, which fails onmain.main.docs/asset-policy.md. (cargo xtask policy: 555 files ok.)Checked for overlap
crates/darner-pe/src/implib.rsorinspect.rs(checked against the file list of all 161 open pull requests), and no open or closed issue mentionsimplib,lib-exportsor import libraries.