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.129.124]) by sourceware.org (Postfix) with ESMTPS id 0307F3858C00 for ; Thu, 29 Jun 2023 16:13:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0307F3858C00 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=1688055197; 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=WKPZ+pWCXlFUh7z8DZv0EawcfdywpiHYzwA6idgVbJc=; b=iI3/GBKT0G26m9X8FwZ3YQ+1/C2tnwrgYD3oG+FSMkYoCyPw1bm2kE5QcYI4KuiyhBMmEb clAt7h4vUiV0AAsQWZOpH4p5yH55VLy0hjt/cLA9ZCO13JNY2N5iJp8svK1eDB0R7cHq7x FS/LjhffwtN/ga6u+iFv6z+uf0YpZ6Y= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-251-l7zUPHCzP3Ch3JfZYI6agw-1; Thu, 29 Jun 2023 12:13:14 -0400 X-MC-Unique: l7zUPHCzP3Ch3JfZYI6agw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-763e092c91aso106848785a.2 for ; Thu, 29 Jun 2023 09:13:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688055194; x=1690647194; 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=WKPZ+pWCXlFUh7z8DZv0EawcfdywpiHYzwA6idgVbJc=; b=GhU8QJ/tfoj9ZyFCfdfKzJIgFzdcodsWLv1LKz6QD/CbT0dogyzqYtOjVQ79dwDWT4 lumBYTkSRnKqs1Kw6bmqyZO53Scmoi4Sa2C2FdiNSwGZHaI0XlsUl9Hc3fNkqZ7TVyTc K+/vlhwiokJ8ymzFaNHMv8D+oFxzO5K05YZtNRESISZZ6Hp6xs/jT/G0Bz+hIXcTDuaI LM0qNnaUa0SCF1FBN9NCSrXm2YwihZ7C+tp9bxgbnhARyzbr66MvNUHxu/PmbYLXGi96 1MEPRyztsDFyZUiE25a9Ducg2bOeok05b3SUhh1S+cwoiyzWg7qHa7qjrM0RoF4mgQVF bETg== X-Gm-Message-State: AC+VfDxM0KwnEIbgsUuK7PyceiExu7ntt5OP+6XnM811vDu2uBg1qycu 7fz1PhBKFZrsy6ZU26bGbJibQ36FeVieBYHmKAworo4a10PF0kYY27zYBys1hiGaXr0bqP4syIT ydp7TkrVHiXMq3ihpnw== X-Received: by 2002:a05:620a:384a:b0:767:1cd5:3456 with SMTP id po10-20020a05620a384a00b007671cd53456mr4734796qkn.39.1688055194019; Thu, 29 Jun 2023 09:13:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ603efCEq8nBwmvfoVbRVAbz46W9Or/aOvsIS3mENoxWpfDfVYKjdhGcG1W26jT0fR2J8SQnA== X-Received: by 2002:a05:620a:384a:b0:767:1cd5:3456 with SMTP id po10-20020a05620a384a00b007671cd53456mr4734778qkn.39.1688055193718; Thu, 29 Jun 2023 09:13:13 -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 u14-20020a05620a120e00b007659935ce64sm5106937qkj.71.2023.06.29.09.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 09:13:13 -0700 (PDT) Date: Thu, 29 Jun 2023 12:13:11 -0400 From: Marek Polacek To: Martin Jambor Cc: Eric Botcazou , 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 Thu, Jun 29, 2023 at 05:58:22PM +0200, Martin Jambor wrote: > Hi, > > On Tue, Jun 27 2023, Marek Polacek wrote: > > 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 :(. > > > > No worries, I can see how these things can easily get difficult. > > Unfortunately I won't have time to actually look at this in the next 2-3 > weeks, so I am inclined to just trust the verification script (which > essentially runs autoconf/automake everywhere and then expects no diff) > and commit the one-line change. What do you think, does that make sense > (even without looking at why other Makefile.in files did not change)? Yes please, go ahead with the one line change meanwhile. Thanks! I've opened PR110467 for the build problem. Marek