public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Marek Polacek <polacek@redhat.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Cc: oliva@adacore.com, Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH] configure: Implement --enable-host-bind-now
Date: Sun, 20 Nov 2022 08:09:22 -0700	[thread overview]
Message-ID: <204aa39e-d85f-8639-08ed-57c8ccf7fdc9@gmail.com> (raw)
In-Reply-To: <20221111025309.188226-1-polacek@redhat.com>


On 11/10/22 19:53, Marek Polacek via Gcc-patches wrote:
> This is a rebased version of the patch I posted in February:
> <https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590201.html>.
>
> Fortunately it is much simpler than the patch implementing --enable-host-pie.
> I've converted the install.texi part into configuration.rst, otherwise
> there are no changes to the original version.
>
> With --enable-host-bind-now --enable-host-pie:
> $ readelf -Wd ./gcc/cc1 ./gcc/cc1plus | grep FLAGS
>   0x000000000000001e (FLAGS)              BIND_NOW
>   0x000000006ffffffb (FLAGS_1)            Flags: NOW PIE
>   0x000000000000001e (FLAGS)              BIND_NOW
>   0x000000006ffffffb (FLAGS_1)            Flags: NOW PIE
>
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
>
> -- >8 --
>
> As promised in the --enable-host-pie patch, this patch adds another
> configure option, --enable-host-bind-now, which adds -z now when linking
> the compiler executables in order to extend hardening.  BIND_NOW with RELRO
> allows the GOT to be marked RO; this prevents GOT modification attacks.
>
> This option does not affect linking of target libraries; you can use
> LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now to enable RELRO/BIND_NOW.
>
> c++tools/ChangeLog:
>
> 	* configure.ac (--enable-host-bind-now): New check.
> 	* configure: Regenerate.
>
> gcc/ChangeLog:
>
> 	* configure.ac (--enable-host-bind-now): New check.  Add
> 	-Wl,-z,now to LD_PICFLAG if --enable-host-bind-now.
> 	* configure: Regenerate.
> 	* doc/install/configuration.rst: Document --enable-host-bind-now.
>
> lto-plugin/ChangeLog:
>
> 	* configure.ac (--enable-host-bind-now): New check.  Link with
> 	-z,now.
> 	* configure: Regenerate.
> ---

OK.  Glad to see this finally get to resolution.  While I'm largely in 
agreement with Jakub that PIE doesn't provide a major security benefit 
for the compiler, it seems better to not have the compiler be special 
WRT security options.


Jeff


  reply	other threads:[~2022-11-20 15:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11  2:53 Marek Polacek
2022-11-20 15:09 ` Jeff Law [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-16 15:37 Marek Polacek
2023-05-19 21:29 ` Jeff Law
2023-06-27 11:39 ` Martin Jambor
2023-06-27 15:31   ` Marek Polacek
2023-06-27 15:50     ` Iain Sandoe
2023-06-27 17:06     ` Eric Botcazou
2023-06-29 15:58     ` Martin Jambor
2023-06-29 16:13       ` Marek Polacek
2022-02-10 16:50 Marek Polacek

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=204aa39e-d85f-8639-08ed-57c8ccf7fdc9@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=oliva@adacore.com \
    --cc=polacek@redhat.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).