From patchwork Mon Jul 10 12:43:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1805797 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=AJzR+HHo; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R03fr1jfDz20XS for ; Mon, 10 Jul 2023 22:46:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8AB8C385AF84 for ; Mon, 10 Jul 2023 12:46:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AB8C385AF84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688993217; bh=CFRyMPGIUUnbT82cGkrVn560RUcGlX32OlAccmwspPs=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=AJzR+HHoQXx3Ph3sGtzBzrI2xemVD5dsRapif2BV2cyODKWkkSzfjQn/RaxNLtN5U +5CkD9p4thLu+JoJLy0xC/nj92GndJ5tM+c0niLRAgTdG2SIlZ8eD3EaEDEPeZpCXy MxOldssVOTSA5CHxOngtPDTY7pBojImsQiLAIo3Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id D2C943857717 for ; Mon, 10 Jul 2023 12:43:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D2C943857717 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbd33a57ddso45455105e9.1 for ; Mon, 10 Jul 2023 05:43:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688993033; x=1691585033; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CFRyMPGIUUnbT82cGkrVn560RUcGlX32OlAccmwspPs=; b=JDHRr1NjoodVdV+g175EsYdcLhPvVpUKz1KHlzeoKAeBW6W42ixKzYcaFZD3a4V59M /5HAMU0zQKJfoUvWN7t703aYyq/zT2jfa3SMhILfAZZs0pSrvfPTwy9i4+8P6zgcnJTG NFgEXWmHFvlbk6BJgwk251c3MAjLGlKSXMWpuLjSQjd/PUfYtiF3vVPsVvYvmOt3Tf9V pVG3TpJh4y5gI5fSGT18DJJ9iGyhSqmk7B/zqm+XmFMO6hW64Goxm5uH1nm45cWbZjZ0 Nw+8Q+3IPW5Nc69edDqqQuEKVi+kR5Li4X8FVyfl0i7raM1KfawqK3txsIOVOFZ+aPm7 UUfA== X-Gm-Message-State: ABy/qLbSrlUbXqqds2EE9C7kknLH7b5YAjH2pLh0jq5TG7BvigRY+Ckx Z7js9T4NTPcqSUBMSpMEFTI74zrq2+h/nd5Du066Hw== X-Google-Smtp-Source: APBJJlF65n+T7r/XO5ThGqOHzrV+EwZZ39i1rBDCvNZJ9nmHuAqhL9mrlOqYskr+GIUI1H7kEK/ryw== X-Received: by 2002:a1c:ed14:0:b0:3fb:4149:b816 with SMTP id l20-20020a1ced14000000b003fb4149b816mr10736133wmh.8.1688993033660; Mon, 10 Jul 2023 05:43:53 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:a197:d20:e621:dddf]) by smtp.gmail.com with ESMTPSA id f6-20020a1c6a06000000b003fc05b89e5bsm6998363wmc.34.2023.07.10.05.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 05:43:53 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Alexandre Oliva Subject: [COMMITTED] ada: hardcfr: optionally disable in leaf functions Date: Mon, 10 Jul 2023 14:43:52 +0200 Message-Id: <20230710124352.2263295-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Alexandre Oliva Document -fhardcfr-skip-leaf. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Control Flow Hardening): Document -fhardcfr-skip-leaf. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/security_hardening_features.rst | 5 +++++ gcc/ada/gnat_rm.texi | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ada/doc/gnat_rm/security_hardening_features.rst b/gcc/ada/doc/gnat_rm/security_hardening_features.rst index cf8c8a2493d..e057af2ea12 100644 --- a/gcc/ada/doc/gnat_rm/security_hardening_features.rst +++ b/gcc/ada/doc/gnat_rm/security_hardening_features.rst @@ -369,6 +369,11 @@ basic blocks take note as control flows through them, and, before returning, subprograms verify that the taken notes are consistent with the control-flow graph. +The performance impact of verification on leaf subprograms can be much +higher, while the averted risks are much lower on them. +Instrumentation can be disabled for leaf subprograms with +:switch:`-fhardcfr-skip-leaf`. + Functions with too many basic blocks, or with multiple return points, call a run-time function to perform the verification. Other functions perform the verification inline before returning. diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 988bb779105..0d11be0c188 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -29515,6 +29515,11 @@ basic blocks take note as control flows through them, and, before returning, subprograms verify that the taken notes are consistent with the control-flow graph. +The performance impact of verification on leaf subprograms can be much +higher, while the averted risks are much lower on them. +Instrumentation can be disabled for leaf subprograms with +@code{-fhardcfr-skip-leaf}. + Functions with too many basic blocks, or with multiple return points, call a run-time function to perform the verification. Other functions perform the verification inline before returning.