From patchwork Mon Jan 10 16:29:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 49806 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 36E2A385842F for ; Mon, 10 Jan 2022 16:30:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36E2A385842F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1641832206; bh=9f2xroey78DrvhE0NS6CCiGy4xThkCiSjc4Itdzmr6Q=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WbUbx0u9NuCe9dzop/pkXMX+0kPN0qOeb4AlUYO4/Qc0bFbAJbtI+O7Gl/BRzXxaG RTaxq9mwqKuCQxlkCGI1J7YU8HXriSaQTWrEVRav4Vblr2W0hmwmT+nhyW6CEAx6kK bOev9T7zaCHxqWtXMSLBhnZPtXfpO5tqL/QOV5cw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from purple.birch.relay.mailchannels.net (purple.birch.relay.mailchannels.net [23.83.209.150]) by sourceware.org (Postfix) with ESMTPS id D98673858425 for ; Mon, 10 Jan 2022 16:29:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D98673858425 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 1F5D84C10B7; Mon, 10 Jan 2022 16:29: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 960EA4C1022; Mon, 10 Jan 2022 16:29:27 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org 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.115.218.6 (trex/6.4.3); Mon, 10 Jan 2022 16:29:28 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Shade-Coil: 79ee30813bd2fbfb_1641832167772_1552437498 X-MC-Loop-Signature: 1641832167772:4070214315 X-MC-Ingress-Time: 1641832167772 Received: from rhbox.redhat.com (unknown [1.186.121.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 4JXfRR3xRvz1J; Mon, 10 Jan 2022 08:29:23 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v4 0/2] _FORTIFY_SOURCE fixes [BZ #28746] Date: Mon, 10 Jan 2022 21:59:12 +0530 Message-Id: <20220110162914.222566-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220105013946.2646963-1-siddhesh@sourceware.org> References: <20220105013946.2646963-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3487.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The main patch is 2/2, which fixes some fortified headers to match feature macros with their corresponding main headers, without which functions would fail to get fortified. Patch 1/2 is a restructuring of the tests so that it is easier to add different configurations to _FORTIFY_SOURCE tests at various levels. Tested on x86_64 to confirm that there were no new regressions due to this and that the new tests also run clean. Changes from v1: - Rebased against latest trunk so that the patches actually apply. - Renamed files so that the diffs are easier to compare and also make a bit more sense. Changes from v2: - Renamed tst-chk-0.c to tst-fortify.c and autogenerate all tests and include it. - Set all the flags we can as -D in CFLAGS and autogenerate test cases if needed. - Fix other review comments. Changes from v3: - Fixed typo (chk-gen-locals -> chk-gen-locales) Siddhesh Poyarekar (2): debug: Autogenerate _FORTIFY_SOURCE tests debug: Synchronize feature guards in fortified functions [BZ #28746] debug/Makefile | 115 ++++++++++++++++++---------- debug/tst-chk2.c | 2 - debug/tst-chk3.c | 2 - debug/tst-chk4.cc | 1 - debug/tst-chk5.cc | 2 - debug/tst-chk6.cc | 2 - debug/tst-chk7.c | 2 - debug/tst-chk8.cc | 2 - debug/tst-fortify-c-default-1.c | 3 + debug/tst-fortify-c-default-2.c | 3 + debug/tst-fortify-c-default-3.c | 3 + debug/tst-fortify-c-lfs-1.c | 3 + debug/tst-fortify-c-lfs-2.c | 3 + debug/tst-fortify-c-lfs-3.c | 3 + debug/tst-fortify-c-nongnu-1.c | 3 + debug/tst-fortify-c-nongnu-2.c | 3 + debug/tst-fortify-c-nongnu-3.c | 3 + debug/tst-fortify-cc-default-1.cc | 3 + debug/tst-fortify-cc-default-2.cc | 3 + debug/tst-fortify-cc-default-3.cc | 3 + debug/tst-fortify-cc-lfs-1.cc | 3 + debug/tst-fortify-cc-lfs-2.cc | 3 + debug/tst-fortify-cc-lfs-3.cc | 3 + debug/tst-fortify-cc-nongnu-1.cc | 3 + debug/tst-fortify-cc-nongnu-2.cc | 3 + debug/tst-fortify-cc-nongnu-3.cc | 3 + debug/{tst-chk1.c => tst-fortify.c} | 49 ++++++++++-- debug/tst-lfschk1.c | 2 - debug/tst-lfschk2.c | 2 - debug/tst-lfschk3.c | 2 - debug/tst-lfschk4.cc | 2 - debug/tst-lfschk5.cc | 2 - debug/tst-lfschk6.cc | 2 - posix/bits/unistd.h | 2 +- string/bits/string_fortified.h | 8 +- support/xsignal.h | 2 + wcsmbs/bits/wchar2.h | 2 +- 37 files changed, 177 insertions(+), 80 deletions(-) delete mode 100644 debug/tst-chk2.c delete mode 100644 debug/tst-chk3.c delete mode 100644 debug/tst-chk4.cc delete mode 100644 debug/tst-chk5.cc delete mode 100644 debug/tst-chk6.cc delete mode 100644 debug/tst-chk7.c delete mode 100644 debug/tst-chk8.cc create mode 100644 debug/tst-fortify-c-default-1.c create mode 100644 debug/tst-fortify-c-default-2.c create mode 100644 debug/tst-fortify-c-default-3.c create mode 100644 debug/tst-fortify-c-lfs-1.c create mode 100644 debug/tst-fortify-c-lfs-2.c create mode 100644 debug/tst-fortify-c-lfs-3.c create mode 100644 debug/tst-fortify-c-nongnu-1.c create mode 100644 debug/tst-fortify-c-nongnu-2.c create mode 100644 debug/tst-fortify-c-nongnu-3.c create mode 100644 debug/tst-fortify-cc-default-1.cc create mode 100644 debug/tst-fortify-cc-default-2.cc create mode 100644 debug/tst-fortify-cc-default-3.cc create mode 100644 debug/tst-fortify-cc-lfs-1.cc create mode 100644 debug/tst-fortify-cc-lfs-2.cc create mode 100644 debug/tst-fortify-cc-lfs-3.cc create mode 100644 debug/tst-fortify-cc-nongnu-1.cc create mode 100644 debug/tst-fortify-cc-nongnu-2.cc create mode 100644 debug/tst-fortify-cc-nongnu-3.cc rename debug/{tst-chk1.c => tst-fortify.c} (97%) delete mode 100644 debug/tst-lfschk1.c delete mode 100644 debug/tst-lfschk2.c delete mode 100644 debug/tst-lfschk3.c delete mode 100644 debug/tst-lfschk4.cc delete mode 100644 debug/tst-lfschk5.cc delete mode 100644 debug/tst-lfschk6.cc