From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from crocodile.elm.relay.mailchannels.net (crocodile.elm.relay.mailchannels.net [23.83.212.45]) by sourceware.org (Postfix) with ESMTPS id 420F13858CDB for ; Mon, 8 Aug 2022 13:26:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 420F13858CDB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D9F1F2A26A4; Mon, 8 Aug 2022 13:26:28 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 651272A23BC; Mon, 8 Aug 2022 13:26:28 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1659965188; a=rsa-sha256; cv=none; b=v0R61t0tsJebmXrFI12z3PMeOkKZZKKVmu1mba9EcCflBAHP3wZed2pCwufV3P0sF4/nRf 8ZtqicPv6V6BytgrTWgqS0MvrdQviFYYkMRo0F1kEgL8FXdhqd42PzV4VVsqsFzEuiIBQ3 4GewlvDIIWy47FS/X5it9uAqVPlUAj1XL0fnpdU06I0MGOoBxnGt1GONH0tGUtRiufMnZg 6ca2GllHIc2mL6gR3Qmqx5Lg0e0p9vYAIHoVWymcM+H/o2QTtN+5jcuDy1fpALJV0CZCan eq5ovnb0z4RgOWZ5G8x4vaOnYZcD5c2Bv0gx6274rsIX8Hphvhh+3g2HDjphKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1659965188; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eC8xgRZwLhINXkBUTyLVtHlM2TOiwf95nbpjNl9Nn6M=; b=tBBuZIYZsmiyAgx1vaazNGmSDarbrEn/3TSm+Scf9Djkhci6aOHgsjUVwVV1YiAzBkEmJI rI4THzTCwH5Yeqku7ExlOgNWEui0qqWU7Nh/pQKzwoXU+r7oDekGwfFy82/8UA+nY1QMPJ kQDbp8RSrQETr+ZX1wjh/a8qqy3DywpwCNLg6MmuySS2yt3UuRzdAxzbG10a9OJ5qJU13V PPp/wc5+81/iBlhB0hg60wPFUNkfo+PWuKQqsLLgRYdH3YqQul1msQU1NSFk5ek1bYuo+f oGcqsTAH5QCC7wif3JJgp9jMGwwM0h/H3ROyAbWv3A65+579zjGJvDGw9Ytnag== ARC-Authentication-Results: i=1; rspamd-7c478d8c66-wmbcj; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Lyrical-Abaft: 5f5c8b1c35585562_1659965188638_83931151 X-MC-Loop-Signature: 1659965188638:4107370939 X-MC-Ingress-Time: 1659965188638 Received: from pdx1-sub0-mail-a304.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.98.207.165 (trex/6.7.1); Mon, 08 Aug 2022 13:26:28 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-16-184-147-84-238.dsl.bell.ca [184.147.84.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a304.dreamhost.com (Postfix) with ESMTPSA id 4M1cRR64M4zQ8; Mon, 8 Aug 2022 06:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1659965188; bh=eC8xgRZwLhINXkBUTyLVtHlM2TOiwf95nbpjNl9Nn6M=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=hX2f3IkuJMC7dUjNrv5gwOO2+1m3cmKU5kX31ncUbVagmM1Zl1QWYieZ9DElRc978 rAAuPo6kRAxG9zr6Bt5vhixvO6ErKqdaL81hd544KNxHhsavFnAtH1eaRklNnhUWaA QrUCj3Yr1tVrVlq4klxiDLUjXA4JD4g5aF1QXw/6FoL+fS+4XVA0rHKiKTyyiZMXsC b9Q7lXp2Cq0wdgw32NhCyVusuXcG4ZWm4zrUE6+lamjwwsEvQbP1P7ZcxNTvzs/QpE nWrSHunuBAADApRgo2UzuFxnlTuGH3Pbhd22Mvqr4vADY8GjzZBW8/YArWS5WkofD3 O/spTKcqJPdLA== Message-ID: <294385d7-3974-9089-e190-782bffd40af8@gotplt.org> Date: Mon, 8 Aug 2022 09:26:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] stdlib: tests: don't double-define _FORTIFY_SOURCE Content-Language: en-US To: Sam James , libc-alpha@sourceware.org References: <20220805201358.2348750-1-sam@gentoo.org> From: Siddhesh Poyarekar In-Reply-To: <20220805201358.2348750-1-sam@gentoo.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3038.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2022 13:26:33 -0000 On 2022-08-05 16:13, Sam James via Libc-alpha wrote: > If using -D_FORITFY_SOURCE=3 (in my case, I've patched GCC to add > =3 instead of =2 (we've done =2 for years in Gentoo)), building > glibc tests will fail on testmb like: > ``` > : error: "_FORTIFY_SOURCE" redefined [-Werror] > : note: this is the location of the previous definition > cc1: all warnings being treated as errors > make[2]: *** [../o-iterator.mk:9: /var/tmp/portage/sys-libs/glibc-2.36/work/build-x86-x86_64-pc-linux-gnu-nptl/stdlib/testmb.o] Error 1 > make[2]: *** Waiting for unfinished jobs.... > ``` > > It's just because we're always setting -D_FORTIFY_SOURCE=2 > rather than unsetting it first. If F_S is already 2, it's harmless, > but if it's another value (say, 1, or 3), the compiler will bawk. > > (I'm not aware of a reason this couldn't be tested with =3, > but the toolchain support is limited for that (too new), and we want > to run the tests everywhere possible.) > > Signed-off-by: Sam James > --- > stdlib/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/stdlib/Makefile b/stdlib/Makefile > index f7b25c1981..d8b59022cc 100644 > --- a/stdlib/Makefile > +++ b/stdlib/Makefile > @@ -380,7 +380,7 @@ CFLAGS-tst-qsort.c += $(stack-align-test-flags) > CFLAGS-tst-makecontext.c += -funwind-tables > CFLAGS-tst-makecontext2.c += $(stack-align-test-flags) > > -CFLAGS-testmb.c += -D_FORTIFY_SOURCE=2 -Wall -Werror > +CFLAGS-testmb.c += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Werror I think we'll be better off with -D_FORTIFY_SOURCE=3 here since the intent is to test the fortified versions of the mb functions and =3 will give the maximum coverage. The downside is that it will emit a warning when building with older gcc (because _FORTIFY_SOURCE=3 is not supported there and protection will downgrade to _FORTIFY_SOURCE=2) so the -Werror will need to go away and maybe even need -Wno-error. Alternatively, some magic here to determine the maximum fortification level wouldn't hurt, but I won't gate your patch on that :) I can work on that bit. Thanks, Sid