build: compile linux release binaries as PIE - #1222
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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=pieto Linux builds in the GitHub Actions release workflow (amd64/arm64, UI/headless). - Add
-buildmode=pieto the Makefilebuild-all-platformsLinux 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.
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.
b207370 to
d5418ad
Compare
|
🎉 This PR is included in version 1.40.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.