TLS: images with AddressOfIndex = 0 #180
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/183"
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?
Imported from ivall/xcl. Originally posted by tshadofr on 2026-11-23T19:31:42Z.
From the TLS list in #106: a TLS directory with
AddressOfIndex = 0(callbacks only, or a template nothing indexes through_tls_index) went throughadj(0), sotls::installwrote the slot number to0 + delta, andtake_slot_zerowrote 0 there again for the executable.The loader now passes a null index pointer for those, and both writes are skipped when it is null. The slot is still allocated and filled, so the callbacks and
/GAslot-0 code see the same block as before.Tested:
cargo test -p xcl --lib tls(newinstall_without_an_index_variable) and the e2e tests pass on an RTX 2060 SUPER. Not run against a game.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-23T20:50:25Z.
Linux / Wine / GNU run of
c69c4d10(merge-base956a476, the currentmain). Ubuntu 24.04, XCL cross-built forx86_64-pc-windows-gnu(mingw-w64 13, release, so no overflow checks), run under Wine 11.21 Staging (Kron4ek wow64 build). The control is this PR's head with only the production hunks reverse-applied, so the new tests stay in.tlsfilter (6 tests incl.pe::tests::parses_own_test_binary_tls, 1 ignored):install_without_an_index_variablelogsunit-noidx: template 16 B, block 4096 B, index 3, threads initialized: 2loader.rsandtls.rsproduction hunks reverted)wine: Unhandled page fault on write access to 0000000000000000, the write through the null index pointer this PR guardsSo the carrier-DLL TLS path,
fill_existing_threadsand the null-index case behave under Wine's loader the way the PR describes for Windows. I read the diff: both writes are guarded, and the slot is still allocated and filled. No findings.Not covered: the
take_slot_zeropath with a null index (no test reaches it); an executable withoutAddressOfIndexloaded end to end; any title.Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T21:09:16Z.
Merged (main
6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on maineaa36b6:cargo build --workspace && cargo test --workspace -- --test-threads=4- 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).