fix(relinker): reject executable TLS symbols in special sections #11038
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11038"
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 boykopovar/AnyPS5. Originally posted by plexerPK on 2026-10-25T14:43:57Z.
What
Executable TLS relocations now reject defined STT_TLS symbols in reserved section indexes before folding their values into the TLS block. Previously SHN_ABS, SHN_COMMON and other reserved indexes could relink successfully when the symbol was not collected as an export. This applies the existing executable-export section policy to relocation-bound symbols; undefined imports retain their existing path.
The change is confined to definedTlsSymbolValue in the executable relocation path. #10731 changes the separate GuestImageReader module path, and merged #10646 validates executable exports.
Tested
macOS arm64, Release relinker-only build at
c1bfd95e3a08a3b35f5576274bdea5da158002deon main3a2c51afd2ee6a824cd3a294912c65e6bbf2b768. All four affected CTests pass:executable_tls_relocations,executable_export_bounds,linux_executable_exportsandmacos_executable_exports. The added matrix covers five section indexes, local/global binding, three TLS relocation kinds and four target modes (120 conversions); invalid sections exit 2 without output, and valid-section controls retain the existing Windows/macOS DTPMOD64 rejection. The regression failed before the guard. Conventions and diff checks pass.Current official overlap reports no conflicting hunks but cannot compare #8076, which conflicts with main; its actual pipeline hunk was manually confirmed to concern separate unwind scanning. Fresh title/text and actual file/diff checks found no competing executable-section guard. #10730's current nonempty-TLS change merges cleanly, and its normal-section empty-TLS cases keep their diagnostic path. Own synthetic ELF fixtures only: these are output-format conversions on macOS, with no Linux/Windows host execution, guest/title execution, GPU or hosted-CI result claimed.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T15:00:59Z.
Review: APPROVED
Reviewed exact head
c1bfd95e3a08a3b35f5576274bdea5da158002de. I configured and built the relinker-only Release target locally, then rantest_executable_tls_relocations.pyagainst that exact binary; it passes. The test exercises the five section indexes across binding, relocation kind and target format, and preserves valid-section controls.git diff --check upstream/main...HEADand conventions pass. Hosted Ubuntu, Windows, macOS arm64, macOS x86_64 and ASan relinker jobs all pass; product jobs are skipped by path policy.