Skip to content

build: compile linux release binaries as PIE - #1222

Merged
rsdmike merged 2 commits into
mainfrom
chore/pie-linux-binaries
Aug 27, 2026
Merged

build: compile linux release binaries as PIE#1222
rsdmike merged 2 commits into
mainfrom
chore/pie-linux-binaries

Conversation

@rsdmike

@rsdmike rsdmike commented Aug 25, 2026

Copy link
Copy Markdown
Member

Add -buildmode=pie to the four Linux release builds so the shipped ELFs are position independent (ASLR) and carry a GNU_RELRO segment. Binary scanners currently report "No PIE / No RELRO" on console_linux_x64 and console_linux_x64_headless.

Windows PE and macOS Mach-O binaries already ship with DYNAMICBASE + HIGH_ENTROPY_VA and MH_PIE respectively, so the flag is a no-op there and is left off.

A PIE ELF declares a PT_INTERP and therefore needs the glibc dynamic loader present at runtime. That is fine for the tarball binaries, which run on glibc distros, but it is why the scratch-based container image in Dockerfile is deliberately left non-PIE.

Cost is ~3% binary size and no measurable build time.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.82%. Comparing base (76d223b) to head (ce40c5a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1222   +/-   ##
=======================================
  Coverage   50.82%   50.82%           
=======================================
  Files         149      149           
  Lines       13873    13873           
=======================================
  Hits         7051     7051           
  Misses       6218     6218           
  Partials      604      604           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Pull request overview

This PR updates the release build configuration to produce Linux release binaries as PIE (Position Independent Executables), improving ASLR posture and enabling RELRO-related ELF hardening characteristics for the shipped tarball artifacts.

Changes:

  • Add -buildmode=pie to Linux builds in the GitHub Actions release workflow (amd64/arm64, UI/headless).
  • Add -buildmode=pie to the Makefile build-all-platforms Linux builds.
  • Add explanatory comments documenting why PIE is Linux-only and why the scratch Docker image remains non-PIE.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Makefile Adds PIE buildmode to Linux cross-compile target and documents the rationale.
.github/workflows/release.yml Adds PIE buildmode to Linux release artifacts and documents portability/runtime implications.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/release.yml Outdated
Comment thread Makefile
Add -buildmode=pie to the four Linux release builds so the shipped
ELFs are position independent (ASLR) and carry a GNU_RELRO segment.
Binary scanners currently report "No PIE / No RELRO" on
console_linux_x64 and console_linux_x64_headless.

Windows PE and macOS Mach-O binaries already ship with DYNAMICBASE +
HIGH_ENTROPY_VA and MH_PIE respectively, so the flag is a no-op there
and is left off.

A PIE ELF still links no shared libraries, but it does declare a
PT_INTERP and so needs the glibc dynamic loader present at runtime.
That is fine for the tarball binaries, and is why the scratch-based
container image in Dockerfile is deliberately left non-PIE.

Cost is ~3% binary size and no measurable build time.
@rsdmike
rsdmike force-pushed the chore/pie-linux-binaries branch from b207370 to d5418ad Compare August 25, 2026 21:10
@rsdmike rsdmike changed the title chore(build): build linux release binaries as PIE build: compile linux release binaries as PIE Aug 25, 2026
@rsdmike
rsdmike marked this pull request as ready for review August 25, 2026 21:13
@rsdmike
rsdmike requested a review from a team as a code owner August 25, 2026 21:13
@rsdmike
rsdmike enabled auto-merge (rebase) August 27, 2026 19:32
@rsdmike
rsdmike merged commit 3a54634 into main Aug 27, 2026
21 checks passed
@rsdmike
rsdmike deleted the chore/pie-linux-binaries branch August 27, 2026 19:35
@RosieAMT

Copy link
Copy Markdown

🎉 This PR is included in version 1.40.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants