public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Lee <ler762@gmail.com>
To: cygwin@cygwin.com
Subject: Re: ASLR revisited
Date: Tue, 03 Mar 2020 06:17:00 -0000	[thread overview]
Message-ID: <CAD8GWsvCymn5Q4ABABMc5akv+YgfQ9NgyPz5THXuPgzWrTredw@mail.gmail.com> (raw)
In-Reply-To: <CAJn6YFBcmnkZ_hGY_OJPguT+m-4UG_2oTCuMCPTD2GVW3JFbDg@mail.gmail.com>

On 3/2/20, John Selbie  wrote:
> And I just discovered that recompiling with this added to the g++ command
> line:
>
>  -Xlinker --dynamicbase
>
> Seems to work. Or at the least, triggers the process to show up in Process
> Explorer as ASLR?
>
> Good idea to continue with this?

I haven't looked at this in ages, but for gcc I use

LDFLAGS="${LDFLAGS} -Wl,--nxcompat"
# https://en.wikipedia.org/wiki/Data_Execution_Prevention
#   Enable DEP with -Wl,--nxcompat

LDFLAGS="${LDFLAGS} -Wl,--dynamicbase,--export-all-symbols"
# https://en.wikipedia.org/wiki/Address_space_layout_randomization
# https://stackoverflow.com/questions/24283918/how-can-i-enable-aslr-dep-and-safeseh-on-an-exe-in-codeblocks-using-mingw
#   ASLR with gcc has a problem: -Wl,--dynamicbase doesn't emit the
necessary relocation table.
#   As a workaround, you can pass -Wl,--dynamicbase,--export-all-symbols

Regards,
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2020-03-03  6:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03  4:26 John Selbie
2020-03-03  4:53 ` John Selbie
2020-03-03  6:17   ` Lee [this message]
2020-03-04 23:29 ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD8GWsvCymn5Q4ABABMc5akv+YgfQ9NgyPz5THXuPgzWrTredw@mail.gmail.com \
    --to=ler762@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).