From patchwork Wed Jan 5 01:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 49539 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 207A1385842C for ; Wed, 5 Jan 2022 01:40:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 207A1385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1641346819; bh=n5UxEqyOe1IeCE0fVN1LQplDyAz6Ev38MLEwv+jPnOI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kf6ia8hwAaNt3zQoCqeFQuQOLPXvO+cfBFYmea2vxeZVAgS0UULr3UiNzWL+TFTQo YqU4s20l/BxKdcHoQWhvZfM2EDVuSkWGoRPR+0WgZY30Ddxtx2LdFwHYz5Pim137tP Y0VDMmwQ0TicLO+fmxJumxcbQ3/YQWPm9bd6gMSc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from cyan.elm.relay.mailchannels.net (cyan.elm.relay.mailchannels.net [23.83.212.47]) by sourceware.org (Postfix) with ESMTPS id AC4883858C2C for ; Wed, 5 Jan 2022 01:39:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC4883858C2C 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 7AA2C216B7 for ; Wed, 5 Jan 2022 01:39:55 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 0988821448 for ; Wed, 5 Jan 2022 01:39:54 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.124.136.120 (trex/6.4.3); Wed, 05 Jan 2022 01:39:55 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Soft-Macabre: 78fb992a107d4f25_1641346795263_3517906650 X-MC-Loop-Signature: 1641346795263:2778684835 X-MC-Ingress-Time: 1641346795263 Received: from rhbox.intra.reserved-bit.com (unknown [1.186.123.58]) (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-a306.dreamhost.com (Postfix) with ESMTPSA id 4JTBxP56Hjz26 for ; Tue, 4 Jan 2022 17:39:53 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 0/2] _FORTIFY_SOURCE fixes Date: Wed, 5 Jan 2022 07:09:44 +0530 Message-Id: <20220105013946.2646963-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.33.1 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_H2, 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. Siddhesh Poyarekar (2): debug: Refactor and expand _FORTIFY_SOURCE tests debug: Synchronize feature guards in fortified functions [BZ #28746] debug/Makefile | 80 +- debug/tst-chk0-lfs.c | 2 + debug/tst-chk0-nongnu.c | 3 + debug/tst-chk0.c | 1759 +++++++++++++++++++ debug/tst-chk0cc-lfs.cc | 2 + debug/tst-chk0cc-nongnu.cc | 3 + debug/tst-chk0cc.cc | 1 + debug/{tst-lfschk1.c => tst-chk1-lfs.c} | 0 debug/tst-chk1-nongnu.c | 3 + debug/tst-chk1.c | 1728 +----------------- debug/{tst-lfschk4.cc => tst-chk1cc-lfs.cc} | 0 debug/tst-chk1cc-nongnu.cc | 3 + debug/{tst-chk5.cc => tst-chk1cc.cc} | 2 +- debug/{tst-lfschk2.c => tst-chk2-lfs.c} | 0 debug/tst-chk2-nongnu.c | 3 + debug/tst-chk2.c | 4 +- debug/{tst-lfschk5.cc => tst-chk2cc-lfs.cc} | 0 debug/tst-chk2cc-nongnu.cc | 3 + debug/{tst-chk6.cc => tst-chk2cc.cc} | 2 +- debug/{tst-lfschk3.c => tst-chk3-lfs.c} | 0 debug/tst-chk3-nongnu.c | 3 + debug/tst-chk3.c | 4 +- debug/{tst-lfschk6.cc => tst-chk3cc-lfs.cc} | 0 debug/tst-chk3cc-nongnu.cc | 3 + debug/{tst-chk8.cc => tst-chk3cc.cc} | 2 +- debug/tst-chk4.cc | 1 - debug/tst-chk7.c | 2 - posix/bits/unistd.h | 2 +- string/bits/string_fortified.h | 8 +- support/xsignal.h | 2 + wcsmbs/bits/wchar2.h | 2 +- 31 files changed, 1844 insertions(+), 1783 deletions(-) create mode 100644 debug/tst-chk0-lfs.c create mode 100644 debug/tst-chk0-nongnu.c create mode 100644 debug/tst-chk0.c create mode 100644 debug/tst-chk0cc-lfs.cc create mode 100644 debug/tst-chk0cc-nongnu.cc create mode 100644 debug/tst-chk0cc.cc rename debug/{tst-lfschk1.c => tst-chk1-lfs.c} (100%) create mode 100644 debug/tst-chk1-nongnu.c rename debug/{tst-lfschk4.cc => tst-chk1cc-lfs.cc} (100%) create mode 100644 debug/tst-chk1cc-nongnu.cc rename debug/{tst-chk5.cc => tst-chk1cc.cc} (54%) rename debug/{tst-lfschk2.c => tst-chk2-lfs.c} (100%) create mode 100644 debug/tst-chk2-nongnu.c rename debug/{tst-lfschk5.cc => tst-chk2cc-lfs.cc} (100%) create mode 100644 debug/tst-chk2cc-nongnu.cc rename debug/{tst-chk6.cc => tst-chk2cc.cc} (54%) rename debug/{tst-lfschk3.c => tst-chk3-lfs.c} (100%) create mode 100644 debug/tst-chk3-nongnu.c rename debug/{tst-lfschk6.cc => tst-chk3cc-lfs.cc} (100%) create mode 100644 debug/tst-chk3cc-nongnu.cc rename debug/{tst-chk8.cc => tst-chk3cc.cc} (54%) delete mode 100644 debug/tst-chk4.cc delete mode 100644 debug/tst-chk7.c