From patchwork Fri Oct 4 11:52:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1992707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Gz0loIS8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4XKn6Z17Ymz1xt7 for ; Fri, 4 Oct 2024 21:55:18 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF7543845148 for ; Fri, 4 Oct 2024 11:55:14 +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 BBA05385EC0A for ; Fri, 4 Oct 2024 11:54:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBA05385EC0A 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 BBA05385EC0A 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=1728042896; cv=none; b=stgLf6NGlixe/eVT5GBHic7FIFiN/EJqxvvLQxyiHEHdrhB7Lk2C2ekGBHhefcbYD1AmYQsNd/uSZNm9yRhfjqM3wPR3vm4ZI3+eR8MJf8M2fVct5mHQZz54iukKgVAHP66JnIsmC9bT8IXKqdLAtT9M/Rtx11D1uw2OGCDp9bs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728042896; c=relaxed/simple; bh=lbNpF9jQEBJLRvuZfDcTxpy6sOS1oFPSXQuyQgd38qg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lqmiwsWPLlZz1mJ+VKJsy2+qg3SJGK1mC8xnH8baB6GKrD3bMQ1JE5sq9V+YM/qVdaeZlA0BiM7Jj9LONUxT+qvbexLUof9WqWsYtIqGtuan3EIAvAB/LH3k5pAVyR7VE/AbU3wXBEtxHMbzaOEKGTGG3QpZn4a8s3E0WGn4uWI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728042894; 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: content-transfer-encoding:content-transfer-encoding; bh=QCxGNKMpbQtpzE+lxZooQHc/BD/piZuOfIOtYMWkytM=; b=Gz0loIS8OR15jq5OGFeMw5zmd1SMAHY6/d5Hknog/C/1g77Nsgm3KZqcGh+lv8OskAZgWK OADB5S7Vzc/j1m2+tI3tw4JxvbXWuFMW0IvQvQj81P+S63ULmC9Vx6vvg25+HgZIPmbQgA V/BQ8dOVxLleVSlQkDCaji9+0/XaDCE= Received: from mx-prod-mc-02.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-478-Wens3FiiMVq6SrrpFDqjfw-1; Fri, 04 Oct 2024 07:54:52 -0400 X-MC-Unique: Wens3FiiMVq6SrrpFDqjfw-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2EE531955BC1; Fri, 4 Oct 2024 11:54:51 +0000 (UTC) Received: from localhost (unknown [10.42.28.136]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8A64019560AD; Fri, 4 Oct 2024 11:54:48 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Sam James Subject: [PATCH] libstdc++: Test 17_intro/names.cc with -D_FORTIFY_SOURCE=2 [PR116210] Date: Fri, 4 Oct 2024 12:52:11 +0100 Message-ID: <20241004115447.3906620-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 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 This doesn't really belong in our testsuite, because the sole purpose of the new test is to find bugs in the Glibc wrappers (like the one linked below). But maybe it's a kindness to do it in our testsuite, because we already have this test in place, and one Glibc bug was already found thanks to Sam running the existing test with _FORTIFY_SOURCE defined. Should we do this? -- >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 6b9a3639aad..bbf45b93dee 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -377,4 +377,11 @@ #undef y #endif +#if defined __GLIBC_PREREQ && defined _FORTIFY_SOURCE +# if __GLIBC_PREREQ(2,35) && ! __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"