Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix segmentation faults of musl binaries with static relocation-model #8135

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

mwrock
Copy link
Contributor

@mwrock mwrock commented Mar 16, 2021

Rust 1.46.0 [enabled Position Independent Executables(PIE) for x86_64-unknown-linux-musl] (rust-lang/rust#70740). This causes the compiled binary to segfault when building with GCC versions that support it. For instance a plain cargo build on ubuntu 18.04 works fine because it comes with v7.5.0 which does not support PIE. However a plan guild will build with v9.1.0 which does and these builds emit a segmentation fault. While we should investigate if there is something in the way we compile GCC which causes this. Setting relocation-model to static suppresses PIE.

Also note that while troubleshooting this, I tried building with rust 1.44.1 and set export RUSTFLAGS='-C link-args=-pie' which worked so there must be some additional nuances in compiler flags beyond simply turning on pie.

Signed-off-by: Matt Wrock matt@mattwrock.com

Signed-off-by: Matt Wrock <matt@mattwrock.com>
@mwrock mwrock requested a review from markan as a code owner March 16, 2021 19:22
@netlify
Copy link

netlify bot commented Mar 16, 2021

Deploy preview for chef-habitat processing.

Building with commit 414bbb7

https://app.netlify.com/sites/chef-habitat/deploys/605105818f89090008a35576

@mwrock mwrock merged commit d86ca57 into master Mar 16, 2021
@mwrock mwrock deleted the no-pie branch March 16, 2021 19:57
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.

1 participant