From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F12AD3858D28 for ; Tue, 27 Jun 2023 15:31:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F12AD3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687879873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=faT/3ackeuJP93cnEXdx8DHqg2O0fVnh09Q/rrRCxdk=; b=HTmGmwUaqihLc1KoOG4kwr35cY6dbjKgp422FduRupSs7oz24r2uS/sqPpO7AMXjmizKR5 1G8/W0gozWCCIJKnTnyV+WpiszCZqJN6ctf7Eokp95prxdJxJL62ADDLGBTRBMB0tBOAW6 nB8CytgX0MaM2uhvvv9w5JxBRQ8dE/Y= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-256-nvTZNw9yPeKdFrWSU9pjrw-1; Tue, 27 Jun 2023 11:31:08 -0400 X-MC-Unique: nvTZNw9yPeKdFrWSU9pjrw-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-635e244d063so23231306d6.1 for ; Tue, 27 Jun 2023 08:31:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687879867; x=1690471867; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=faT/3ackeuJP93cnEXdx8DHqg2O0fVnh09Q/rrRCxdk=; b=lnnNut0p9HU3+FrHsXhhWyQA76qeX6joS4s+EoiIq23FAsM2fVoMvDFX8/pg+5gGWf k/PkhH+3K1FggnjZeq1jPcCUF90lJe+Sze+wOoqkPQgP/jwB+pSDR2kPJVRz1iv4QS4f mJ0EccnlP8L8uHg1HE9e+VJcbwCu5RvMhOuWIGg8Xq1GMoDUaEdsvj+HbJCoBHva3dFc /oC5q293R7iiZHmrPUJHQ5BK6bTC8wTb54xQx5VfHLsYOjGAMnRkEszWL/aXmpv1UgWS VsT9A99b2l7jSelpdxZOl6+fj9otdFUviZcQlwm/PJfC6fxIRWSeJFh7MVoDcMyTvfuN D93w== X-Gm-Message-State: AC+VfDyfzTJhjbB2v0FVjij6DYZJWCMF2f7mkr5VbSiD20KXlRw3FYXM f3GT7YaYQO8HyVjyJHa53vVbDbiHzTdtlngUqBAqESbff5PYH6Bllw97KVMoKJZDh0uTjRs0zQV cTLD8R3/m8w/fvWDCJw== X-Received: by 2002:a05:622a:1889:b0:3ff:2923:48a with SMTP id v9-20020a05622a188900b003ff2923048amr28419733qtc.3.1687879867319; Tue, 27 Jun 2023 08:31:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KGl3ZBTlP2wKsNlKQ7Wlq6txCYZcgK2s4ZSFgtvzGz+n0MZE494BPKjr8LU6Tr7bFHbwqsg== X-Received: by 2002:a05:622a:1889:b0:3ff:2923:48a with SMTP id v9-20020a05622a188900b003ff2923048amr28419703qtc.3.1687879866929; Tue, 27 Jun 2023 08:31:06 -0700 (PDT) Received: from redhat.com (2603-7000-9500-34a5-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:34a5::1db4]) by smtp.gmail.com with ESMTPSA id w22-20020ac843d6000000b003fb6cd74482sm4654851qtn.50.2023.06.27.08.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 08:31:06 -0700 (PDT) Date: Tue, 27 Jun 2023 11:31:04 -0400 From: Marek Polacek To: Martin Jambor , Eric Botcazou Cc: GCC Patches Subject: Re: [PATCH] configure: Implement --enable-host-bind-now Message-ID: References: MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.9 (2022-11-12) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Jun 27, 2023 at 01:39:16PM +0200, Martin Jambor wrote: > Hello, > > On Tue, May 16 2023, Marek Polacek via Gcc-patches wrote: > > 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. > > > > With this patch: > > $ readelf -Wd cc1{,plus} | 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? > > > > 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.texi: Document --enable-host-bind-now. > > > > lto-plugin/ChangeLog: > > > > * configure.ac (--enable-host-bind-now): New check. Link with > > -z,now. > > * configure: Regenerate. > > Our reconfiguration checking script complains about a missing hunk in > lto-plugin/Makefile.in: > > diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in > index cb568e1e09f..f6f5b020ff5 100644 > --- a/lto-plugin/Makefile.in > +++ b/lto-plugin/Makefile.in > @@ -298,6 +298,7 @@ datadir = @datadir@ > datarootdir = @datarootdir@ > docdir = @docdir@ > dvidir = @dvidir@ > +enable_host_bind_now = @enable_host_bind_now@ > exec_prefix = @exec_prefix@ > gcc_build_dir = @gcc_build_dir@ > get_gcc_base_ver = @get_gcc_base_ver@ > > > I am somewhat puzzled why the line is not missing in any of the other > Makefile.in files. Can you please check whether that is the only thing > that is missing (assuming it is actually missing)? Arg, once again, I'm sorry. I don't know how this happened. It would be trivial to fix it but since commit 4a48a38fa99f067b8f3a3d1a5dc7a1e602db351f Author: Eric Botcazou Date: Wed Jun 21 18:19:36 2023 +0200 ada: Fix build of GNAT tools the build with Ada included fails with --enable-host-pie. So that needs to be fixed first. Eric, I'm not asking you to fix that, but I'm curious, what did the commit above fix? The patch looks correct; I'm just puzzled why I hadn't seen any build failures. The --enable-host-pie patch has been a nightmare :(. Marek