Message ID | 20201215182238.2780547-1-siddhesh@sourceware.org |
---|---|
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> 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 2E65E386F83A; Tue, 15 Dec 2020 18:23:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E65E386F83A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608056583; bh=XYcPCG0fulNgZz+cRnF2MNO9xXKfGV1D5VzOxqTMP2E=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Fsynicv/HGflI2xgsmo3iXY92pJxoD+XXTx7/EtmTt1oV5kQvqoXMiwAtsv14J5C0 LDMQT8GkMu5RKnBclZScAzL9gVQC6RHNj1WTW7KSbT38Y72XK4tkugZm4TGcI5iNbb vD86WOqkDOt6ynUKgqR5Nxq2cfQ9JYUbff5VlCGs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from camel.birch.relay.mailchannels.net (camel.birch.relay.mailchannels.net [23.83.209.29]) by sourceware.org (Postfix) with ESMTPS id AB24E3846078 for <libc-alpha@sourceware.org>; Tue, 15 Dec 2020 18:22:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AB24E3846078 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 C55691E2770; Tue, 15 Dec 2020 18:22:57 +0000 (UTC) Received: from pdx1-sub0-mail-a35.g.dreamhost.com (100-105-161-17.trex.outbound.svc.cluster.local [100.105.161.17]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 4DBD11E2691; Tue, 15 Dec 2020 18:22:57 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a35.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.11); Tue, 15 Dec 2020 18:22:57 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Tank-Minister: 02d81ec21cb0aa64_1608056577610_3341274417 X-MC-Loop-Signature: 1608056577609:2443864116 X-MC-Ingress-Time: 1608056577609 Received: from pdx1-sub0-mail-a35.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTP id F02697F4E0; Tue, 15 Dec 2020 10:22:56 -0800 (PST) Received: from rhbox.redhat.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTPSA id 85C4C7E357; Tue, 15 Dec 2020 10:22:53 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a35 To: libc-alpha@sourceware.org Subject: [PATCH v4 0/2] _FORTIFY_SOURCE=3 Date: Tue, 15 Dec 2020 23:52:36 +0530 Message-Id: <20201215182238.2780547-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Siddhesh Poyarekar <siddhesh@sourceware.org> Cc: fweimer@redhat.com, jakub@redhat.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series | _FORTIFY_SOURCE=3 | |
Message
Siddhesh Poyarekar
Dec. 15, 2020, 6:22 p.m. UTC
Posting the full series again with fixes for convenience. Since the patches were deemed OK with some cosmetic change suggestions, I'll commit this series by the end of the week if there are no further comments. ------------- This patchset implements a new fortification level, _FORTIFY_SOURCE=3. This level allows size information to be dynamic, which may potentially have a noticeable performance impact. It uses the __builtin_dynamic_object_size builtin available in clang to expand coverage of fortifications at the expense of some performance. Patch 1/2 implements the base support and support for functions that have builtins of string functions. Additionally, the patch also describes the use case and tradeoffs. Patch 2/2 adds support for non-string functions that are fortification-ready for levels 1 and 2. Testing: The glibc testsuite doesn't directly support clang at the moment, so having tests in the glibc source tree is pointless as long as gcc does not have support for __builtin_dynamic_object_size. There is a separate project on GitHub called fortify-test-suite[1] that houses fortification tests and is capable of testing multiple levels of fortification with multiple compilers. I have proposed a PR[2] to add support for _FORTIFY_SOURCE=3 and have verified my changes with those tests. Those tests run clean for clang when run with these changes and PR[2] and they fail at level 3 for gcc, as expected. [1] https://github.com/serge-sans-paille/fortify-test-suite [2] https://github.com/serge-sans-paille/fortify-test-suite/pull/9 Changes from previous series: - Incorporated NEWS and creature.texi wording change suggestions - Fixed comment in 2/2. Siddhesh Poyarekar (2): string: _FORTIFY_SOURCE=3 using __builtin_dynamic_object_size nonstring: _FORTIFY_SOURCE=3 using __builtin_dynamic_object_size NEWS | 6 ++ include/features.h | 11 ++- include/string.h | 5 +- io/bits/poll2.h | 16 ++-- libio/bits/stdio.h | 2 +- libio/bits/stdio2.h | 53 ++++++------- manual/creature.texi | 3 +- misc/sys/cdefs.h | 9 +++ posix/bits/unistd.h | 112 ++++++++++++++------------- socket/bits/socket2.h | 18 ++--- stdlib/bits/stdlib.h | 37 ++++----- string/bits/string_fortified.h | 22 +++--- string/bits/strings_fortified.h | 4 +- wcsmbs/bits/wchar2.h | 131 ++++++++++++++++---------------- 14 files changed, 231 insertions(+), 198 deletions(-)