Repository navigation
TLS: preserve Characteristics alignment and fix on_thread_attach contention (#106) - #196
JGonzalezRodriguez wants to merge 2 commits into
Conversation
|
I built PR head On base The alignment mask, RVA rounding and relocated-address checks agree. Moving registration after the successful carrier load also avoids retaining a placeholder on load failure. One wording detail in the PR description: the old write guard already ended at the push statement before LoadLibraryW. The contention bug comes from skipping initialization when try_read misses that short write. These checks used synthetic carrier DLLs. Issue #106 still needs a title-side run. |
|
Thanks @Kalmarv for running the native Windows 11 verification (including the base-commit control checks) and for catching that PR description wording! Pushed follow-up commit Summary of what
AI-assisted. |
466425d to
49d28fc
Compare
|
Tested on Windows with an NVIDIA RTX 3060 (32-lane waves), merged onto current main.
Synthetic tests only, no game data. tests were run by me. |
|
Test run of Tested
Review: Note the overlap with #431 (open), which removes Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Regression run on a retail title for #196, since Not tested lists it: head Tested
The second block is the local merge onto Not tested
AI use
|
Part of #106. Preserves
IMAGE_TLS_DIRECTORY64.Characteristicsalignment in synthetic carrier DLLs and fixeson_thread_attach()skipping TLS initialization underIMAGES.write()contention.What is in it
pe.rs,tls.rs,loader.rs: Decode and sanitizeIMAGE_TLS_DIRECTORY64.Characteristicsalignment bits (bits 20..23IMAGE_SCN_ALIGN_*BYTES, nibble1..=14→1..=8192B, clearing reserved bits and0xF). AlignStartAddressOfRawDatainbuild_carrier_dll_with()to the requested alignment, clampu32/u64carrier size arithmetic (MAX_CARRIER_TEMPLATE), and reject oversized requests intls::install()before creating files or writing*index_ptr.tls.rs: Fixon_thread_attach()silently skipping template initialization whenIMAGES.try_read()hitsWouldBlockduring the shortIMAGES.write()push. Move registration afterLoadLibraryW(avoidingNO_INDEXplaceholders on load failure), write*index_ptr = index(when non-null) only afterIMAGES.write()succeeds, and use blockingIMAGES.read()under the lock order OS loader lock →MOVED→IMAGES.Tested
610.57.4,rustc 1.98.1x86_64-pc-windows-msvcviaclang-cl 23.1.1+lld-link+xwinSDK10.0.26100, Proton Experimental + local relaxedvkd3d-proton):cargo build --release --workspace --target x86_64-pc-windows-msvc: 0 errors, 0 warnings.pe::tests::: 12 passed, 0 failed.tls::tests::(parallel &--test-threads=1): 8 passed, 0 failed, 1 ignored (carrier_variants_probe).loader::tests::: 2 passed, 0 failed.xcl_testtitle.exe: 47/50 passed (all TLS/loader/DLL/D3D12.X checks pass; 3 known Wine/FAudio diffs).@mmmhariuson49d28fcmerged onto60565c4(Windows + RTX 3060): fullscripts/test.ps1(incl. e2excl_testtitle) — 617 passed, 0 failed, 20 ignored (2 GPU skips:no wave64).@Kalmarvon prior commitdd71d57(Windows 11 Pro 26200, x64 MSVC,rustc 1.99.0): all 12 PE/TLS tests passed (including live 32..=8192 B alignment on invoking + 8 new threads; 4 carried-back behavior tests failed on base956a476).Regression run
scripts/smoke.ps1run by a tester with a retail title.Not tested
scripts/smoke.ps1regression run.AI use