From patchwork Wed Oct 9 14:45:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1994910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eUbtmaoB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XNwl51w7Yz1xsv for ; Thu, 10 Oct 2024 01:49:21 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 75BB538650F4 for ; Wed, 9 Oct 2024 14:49:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id EC983385DDDF for ; Wed, 9 Oct 2024 14:48:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC983385DDDF Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC983385DDDF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728485335; cv=none; b=Czz8VotE9HFa7heH+44OXhhXXXTP+utACpaysntHvfAB1110nTaIGk2R61klWsYeDrnjPtBbEuO5qRbFtu4KQ/C4fV30QvHF+yhNHbGImB5KyFRFLA4C579CfWebmgS/byZVJQ7ZXxKsupXHtp9/ojHT6zSDVLlbbZ6x39DT7tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728485335; c=relaxed/simple; bh=aVBu2bHbAjEo4gHGebVIEdGRQddjS/RfgHm3/7N+4js=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=CrJWokuhhbqZK5ul1TD8AbxFVjhVl3x6CXVmz4H7I+kxdeSgY9tfzJMNAWpe2V/S17kSt+MtbV8Re1UMNLYRkWNl7AWtV78T32/dK4J1Ek/Xz5YzyJEVNW5DkoeJ61jPXQjk85VgJ2kFqIPS9xv2rr7RExDaVkgNdr+QAqq90QQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728485332; 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; bh=2RTG9axf/SDCC0mwRi5d2EMrITuIxMbFLyFsTshsOy8=; b=eUbtmaoBHEvQk0f91VUXTlj/fTd1oOzHMfx4YEYVLLTXpffBFySSDdURn8j1O4w9v+PiN+ VxtQiSHzlXhqMHtDad2uGo/IfR2qlYcl0VBJdn24+cRKHOzGIbD848jEl3820NwnWp1mcm dMQHBinTUEVhIA1e6FC7ENZsUiaRJbk= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-648-olWiO1tDMX6RAl0cZuKarA-1; Wed, 09 Oct 2024 10:48:51 -0400 X-MC-Unique: olWiO1tDMX6RAl0cZuKarA-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6FDB51955F42; Wed, 9 Oct 2024 14:48:49 +0000 (UTC) Received: from localhost (unknown [10.42.28.136]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7B29A300018D; Wed, 9 Oct 2024 14:48:47 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed, v2] libstdc++: Test 17_intro/names.cc with -D_FORTIFY_SOURCE=2 [PR116210] Date: Wed, 9 Oct 2024 15:45:52 +0100 Message-ID: <20241009144846.625272-1-jwakely@redhat.com> In-Reply-To: <20241004115447.3906620-1-jwakely@redhat.com> References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 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_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org I removed the >= 2.35 check, because it was failing on a RHEL glibc 2.34 with the fortify changes backported. So let's just #undef u for anything older than 2.41 instead. Tested powerpc64le-linux (glibc-2.34-100.el9_4.3) and x86_64-linux (glibc-2.39-22.fc40). Pushed to trunk. -- >8 -- Add a new testcase that repeats 17_intro/names.cc but with _FORTIFY_SOURCE defined, to find problems in Glibc fortify wrappers like https://sourceware.org/bugzilla/show_bug.cgi?id=32052 (which is fixed now). libstdc++-v3/ChangeLog: PR libstdc++/116210 * testsuite/17_intro/names.cc (sz): Undef for versions of Glibc that use it in the fortify wrappers. * testsuite/17_intro/names_fortify.cc: New test. --- libstdc++-v3/testsuite/17_intro/names.cc | 7 +++++++ libstdc++-v3/testsuite/17_intro/names_fortify.cc | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 libstdc++-v3/testsuite/17_intro/names_fortify.cc diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index bea2d19ecba..5deb310dc31 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -383,4 +383,11 @@ #undef y #endif +#if defined __GLIBC_PREREQ && defined _FORTIFY_SOURCE +# if ! __GLIBC_PREREQ(2,41) +// https://sourceware.org/bugzilla/show_bug.cgi?id=32052 +# undef sz +# endif +#endif + #include diff --git a/libstdc++-v3/testsuite/17_intro/names_fortify.cc b/libstdc++-v3/testsuite/17_intro/names_fortify.cc new file mode 100644 index 00000000000..c975412074b --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/names_fortify.cc @@ -0,0 +1,6 @@ +// { dg-do compile { target *-*-linux* } } +// { dg-add-options no_pch } + +#define _FORTIFY_SOURCE 2 +// Now we can define the macros to poison uses of non-reserved names: +#include "names.cc"