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

use ASLR on Windows #16514

Closed
thestinger opened this issue Aug 15, 2014 · 6 comments · Fixed by #16588, #17363 or #75406
Closed

use ASLR on Windows #16514

thestinger opened this issue Aug 15, 2014 · 6 comments · Fixed by #16588, #17363 or #75406
Labels
A-security Area: Security (example: address space layout randomization). C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@thestinger
Copy link
Contributor

This should be as simple as passing --dynamicbase to the linker for both libraries and executables. However, the necessary relocations are never generated by MinGW or MinGW-w64 for executables so nothing is actually randomized without also passing --export-all-symbols. The -pie switch is also broken and results in a messed up entry point, but it may not actually be required.

@thestinger thestinger changed the title use full ASLR on Windows use ASLR on Windows Aug 16, 2014
@thestinger thestinger self-assigned this Aug 19, 2014
bors added a commit that referenced this issue Aug 19, 2014
@postessive
Copy link

Hi,

I found this issue while looking for an old reference, but I thought you might be interested in a possible fix. We needed --dynamic-base for Tor's hardening options and after some back and forth settled on a working binutils patch which is here (works for 2.24 and is being submitted upstream shortly):

https://gitweb.torproject.org/user/erinn/tor-browser-bundle.git/commitdiff/631b64262ea66f9529a2ef552734a88d7171a594

This patch has not been reviewed at all, since no one at Tor feels sufficiently capable. Hopefully the binutils folks will have something to say, but as language developers you might too. (edit: fix link to patch)

@thestinger
Copy link
Contributor Author

@postessive: We ended up working around it for the time being by doing a dllexport of main in order to force it to output a relocation section, since the executable counts as a library. I would really like to have this fixed properly though so I'll look into it some more when I have time.

@thestinger
Copy link
Contributor Author

Needs to be disabled again due to #17684.

@klutzy
Copy link
Contributor

klutzy commented Feb 14, 2015

Note that recent binutils may have support for high entropy ASLR. (The patch was accepted last year. See #16593) It would be good to check if mingw-w64 would contain the patch when we re-enable ASLR.

@steveklabnik
Copy link
Member

Triage: not sure if anything has changed here, but I don't think so.

@steveklabnik steveklabnik added O-windows-gnu Toolchain: GNU, Operating system: Windows and removed O-windows Operating system: Windows labels Mar 4, 2016
@steveklabnik
Copy link
Member

Triage: same as in 2016

@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 12, 2020
@bors bors closed this as completed in d65c08e Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-security Area: Security (example: address space layout randomization). C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants