Skip to content

Initial support for static PIE executables#3960

Closed
LemonBoy wants to merge 1 commit intoziglang:masterfrom
LemonBoy:piepiepie
Closed

Initial support for static PIE executables#3960
LemonBoy wants to merge 1 commit intoziglang:masterfrom
LemonBoy:piepiepie

Conversation

@LemonBoy
Copy link
Contributor

Caveats:

  • Not enabled by default
  • Not working on mipsel yet
  • Untested with glibc, musl & standalone work just fine

@andrewrk
Copy link
Member

The use case for this is Address Space Layout Randomization, right? Anything else?

return @intToPtr([*]elf.Dyn, addr);
}

pub fn apply_relocations() void {
Copy link
Contributor

Choose a reason for hiding this comment

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

Case-styling? Or is this a traditional name from somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm still not used to camelCase all the identifiers, will change it later :)


// Do this as early as possible, the aux vector is needed
if (builtin.position_independent_executable) {
@import("os/linux/start_pie.zig").apply_relocations();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to pass in auxv instead of using it indirectly via the global?

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

I think this is good to merge once it's passing the CI.

I do want to know what the use case is though, to better understand how defaults should work, and to understand why people might want to enable this feature. Is it just for ASLR?

@LemonBoy
Copy link
Contributor Author

LemonBoy commented Jan 8, 2020

I think this is good to merge once it's passing the CI.

This depends on #3971 landing

I do want to know what the use case is though, to better understand how defaults should work, and to understand why people might want to enable this feature. Is it just for ASLR?

Yep

@andrewrk
Copy link
Member

I opened #4503 so that this diff doesn't get lost. Closing the PR since it's not merge-ready and hasn't been for over a month.

@andrewrk andrewrk closed this Feb 18, 2020
andrewrk added a commit that referenced this pull request Nov 23, 2020
This is the part of #3960 that has to be rewritten to apply to latest
master branch code.
andrewrk added a commit that referenced this pull request Nov 23, 2020
Closes #4503
Revives #3960
Merges branch 'pie' into master
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.

3 participants