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: 117894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4998548vqx; Mon, 10 Jul 2023 05:48:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFThJ6xCmu9BE29DRahinmYpoMK4Ry1VjvLGTUrxub3s1bC/v1fjTLd6EN8bj8RnovqsmTB X-Received: by 2002:a05:6512:39d0:b0:4fb:7392:c72c with SMTP id k16-20020a05651239d000b004fb7392c72cmr10110558lfu.57.1688993297996; Mon, 10 Jul 2023 05:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688993297; cv=none; d=google.com; s=arc-20160816; b=cs7GhWYPpt7oeBRO0n/ImfgvCqK8MUDY9Rhq3T52qqWQUI1/SqIxujklriI+h5RAY9 0+aPlSeOxmAjRp3uO4C899g04sgBvucdem46DKVxU/sKzScmFg/3X3mv3uRFJNRxaZpq 4ak7ff6oW65EBA8sepXeEESY0TuPGu4JovvZ6LzDo8jr5aIQupJjMVCM40b8xy3lRWr7 JCo/KgZs7DG7bDqG0ny9MSsrmKQDgBSBZ1RToB+px5+3GYkGFeJ3BhczTVVuQFOtp3lP cA4l9b/HjKmX2sqDyg25dNItIv6T3hvlpemIqWoUAXq3El/FuBZlHdG2A4MP/xuQwb2Q D1Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=CFRyMPGIUUnbT82cGkrVn560RUcGlX32OlAccmwspPs=; fh=3I5BNKWyYtN8OAcHgwE9DP+SPMWTdvCyaas7z1IN2Vo=; b=reIm0uWPaFdDqs9MMeyBS2WjLoy02bVbRL4FTe0+yHcjHNY4F96fLKcavsZfzvxQDj 4xhZAnB+hJAeU/R3h8BDwEy4F5Hd8DWpv9HprY8xcCMaKaTTfhJq5GFuepbU5pNeqAdQ sfdlw0JzPtaFSF8+fKQcYM65/WpLltpLtaima9zwwcjS9YkWjYhucH2pScjyIyQiu/zO kHqW+UWEgWAZkfpxq6lvHM1zAOX+2izTiQYxAt/Y/Yi8Krh8M0LsSrBB4KDgDjfSVn+w GDW3gWBjNtzG93GL/30GouwEq3/S7CtgTtcWmOO6BMEZneD2O7iBIrJr7AaKLTr45gF8 flPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oY8vZEmU; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d22-20020a170906345600b00977eb8d769bsi9942285ejb.289.2023.07.10.05.48.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 05:48:17 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oY8vZEmU; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BFEBE3858004 for ; Mon, 10 Jul 2023 12:47:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BFEBE3858004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688993240; bh=CFRyMPGIUUnbT82cGkrVn560RUcGlX32OlAccmwspPs=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=oY8vZEmUR1AsKofjofWBGvffCKUcr2AObcNcSxcmDQTbDuS0F5I7fh1KoicVHEy96 rKFCFyVosjUiGuwDcnxvTjTiat4c9FZDdhsPuHhDPzXn0gu3yLLoWl2T8l5HeQ45Ts VWxVqSrA7PqZVAqFQPR+Vq7Kv6ZGsF2UwVPVMFGg= 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-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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771037836468686625 X-GMAIL-MSGID: 1771037836468686625 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.