Skip to content

Enable BIND_NOW by default for ELF binaries - #2677

Merged
George Adams (gdams) merged 2 commits into
microsoft/mainfrom
dev/qmuntal/bind-now
Oct 30, 2026
Merged

George Adams (gdams) merged 2 commits into
microsoft/mainfrom
dev/qmuntal/bind-now

Conversation

@qmuntal

Copy link
Copy Markdown
Member

Summary

  • Enable BIND_NOW by default for dynamic ELF outputs, using the existing internal and external linker support, to align with Microsoft security policies.
  • Preserve -bindnow=false and leave static binaries and non-ELF behavior unchanged.
  • Extend ELF binding and RELRO regression coverage, and update the release notes, feature documentation, and migration guide.

Fixes #851.

Validation

  • Rebuilt Windows/arm64 and Linux/amd64 toolchains on the current upstream baseline.
  • Passed Windows linker tests and Linux linker and c-shared suites.
  • Passed native crypto/cgo/no-cgo/race executable and test-binary checks.
  • Passed ELF binding, ASan build-mode, and full short sanitizer suites in Mariner 2 and Azure Linux 3.
  • Verified pure-Go default/opt-out execution and unchanged static linking.
  • Inspected BIND_NOW flags in Linux/arm64 and OpenBSD/amd64 cross-builds.
  • Verified forward patch application, the generated index checksum, and formatting.

Enable immediate function binding by default with the existing internal and external linker support, preserving -bindnow=false. Extend ELF binding and RELRO coverage, and document the new default and Microsoft security-policy rationale.

Fixes #851.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 07:52
@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner October 30, 2026 07:52
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The missing upstream Go submodule prevents inspection of the existing ELF linker and complete test harness needed to validate this cross-platform security-default change.

No open issues 🎉

What changed in this PR

Enables immediate symbol binding (BIND_NOW) by default for dynamically linked ELF outputs in the Microsoft build of Go, addressing #851 and aligning with Microsoft security policies.

Changes:

  • Changes the linker default while preserving -bindnow=false and leaving static and non-ELF behavior unchanged.
  • Extends regression coverage for binding flags, RELRO, and shared libraries.
  • Documents the Go 1.28 behavior and opt-out instructions.

Patches are happy!

File Description
patches/​index.json Registers the new patch and refreshes patch metadata.
patches/​0015-Enable-BIND_NOW-by-default.patch Enables the default and updates linker documentation and regression tests.
eng/​doc/​MigrationGuide.md Adds migration guidance and the opt-out flag.
eng/​doc/​AdditionalFeatures.md Explains immediate binding, its scope, and how to disable it.
docs/​go1.28.md Announces the new default in the release notes.

Review effort: Balanced

Ubuntu GCC enables immediate binding by default, so -bindnow=false alone does not clear the ELF NOW flags. Give external-link tests a lazy-binding baseline through -extld before Go adds its own flags. This keeps both enablement and opt-out checks meaningful without passing linker-only options to C compilation.

Clarify that the external C toolchain can still enable immediate binding independently. Verified all binding cases with GCC and Clang, with and without system crypto, in the Ubuntu CI image.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gdams
George Adams (gdams) merged commit 643c1b4 into microsoft/main Oct 30, 2026
75 checks passed
@gdams
George Adams (gdams) deleted the dev/qmuntal/bind-now branch October 30, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable BIND_NOW in ELF binaries (BinSkim)

3 participants