From patchwork Mon Jul 10 12:43:49 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: 1805796 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=bqb2Hsf2; 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 4R03dl3GNgz20XS for ; Mon, 10 Jul 2023 22:46:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6835E3850AC2 for ; Mon, 10 Jul 2023 12:46:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6835E3850AC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688993161; bh=H6OnhC7YYYyFKJBYY6/GgJDlCIikk/OlQVBa8CiqotU=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=bqb2Hsf2DPS3CJAUnSXvHxavIzwMoorc/IZFzUM+/HpQL5pCiP3b8BjTlcqg+NY/z e8jeTbi/9YJmUW62pT+t8m9QrNmJTz878kQ1aYdJwSfX9ZC8+IVAs4PWLlsXZE8e7C 4pS3ga3gCfsfEDOyzRDiUD1kI7m+lT59q7KXP4tg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 0847D3857C44 for ; Mon, 10 Jul 2023 12:43:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0847D3857C44 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fbd33a57ddso45454775e9.1 for ; Mon, 10 Jul 2023 05:43:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688993032; x=1691585032; 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=H6OnhC7YYYyFKJBYY6/GgJDlCIikk/OlQVBa8CiqotU=; b=V+FHE3eOe0Wlou641AIaN5+lDHy/UHABK/xQ5tEbB0AnxUg2ya+iwQp5BvF1wtSuxt kdl1C0Vrtfv0W7hOyF4Y3Vyl1VxoEhjS9V9qOagHdwbzS8CjnCnGtdkxTcGkVkFtg/qg fXHcam3at80GVWlJ8EejcwKqYtZx4WnifAxWdov2wtpbVUtqZYsMEvt4bI+XFCHA20gs FxxGzr5UNqaVJIZc6/a7CEhVMn7qnmel4rMDX0dPeQKENTUFfuWSjKn9ojWgIlYAERLa VNCkiMc1s+isB8BDdi8O4klYtFXekJ+2m7AqbJRbJ4SZdLEfDardSQHUK14QCgPkXYWX 7W/g== X-Gm-Message-State: ABy/qLbuY9l0aqf/VZffJurG7G3lJrAVmZE2j2aK0l1kOOSLURnU679d l2233gJyaOVkHNMKYJei33yDf2h6GchkzetQIk6LbA== X-Google-Smtp-Source: APBJJlGQJBDE0V4xBSWmVNIdf4l+34WnhW19Iz/T+n1w8Hh/3Zo/URk9bYa2Idp44PjXsdmdYHcbSw== X-Received: by 2002:a7b:cd0d:0:b0:3fc:1fb:79d3 with SMTP id f13-20020a7bcd0d000000b003fc01fb79d3mr6530490wmj.15.1688993031684; Mon, 10 Jul 2023 05:43:51 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:a197:d20:e621:dddf]) by smtp.gmail.com with ESMTPSA id f17-20020a7bc8d1000000b003fa968e9c27sm10282823wml.9.2023.07.10.05.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 05:43:51 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Alexandre Oliva Subject: [COMMITTED] ada: hardcfr: mark throw-expected functions Date: Mon, 10 Jul 2023 14:43:49 +0200 Message-Id: <20230710124349.2263234-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 Adjust documentation to reflect the introduction of -fhardcfr-check-noreturn-calls=no-xthrow. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Control Flow Redundancy): Add -fhardcfr-check-noreturn-calls=no-xthrow. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../doc/gnat_rm/security_hardening_features.rst | 17 +++++++++-------- gcc/ada/gnat_rm.texi | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/security_hardening_features.rst b/gcc/ada/doc/gnat_rm/security_hardening_features.rst index 14328598c33..cf8c8a2493d 100644 --- a/gcc/ada/doc/gnat_rm/security_hardening_features.rst +++ b/gcc/ada/doc/gnat_rm/security_hardening_features.rst @@ -493,17 +493,18 @@ gets modified as follows: end; -Verification may also be performed before No_Return calls, whether -only nothrow ones, with -:switch:`-fhardcfr-check-noreturn-calls=nothrow`, or all of them, with -:switch:`-fhardcfr-check-noreturn-calls=always`. The default is -:switch:`-fhardcfr-check-noreturn-calls=never` for this feature, that -disables checking before No_Return calls. +Verification may also be performed before No_Return calls, whether all +of them, with :switch:`-fhardcfr-check-noreturn-calls=always`; all but +internal subprograms involved in exception-raising or -reraising, with +:switch:`-fhardcfr-check-noreturn-calls=no-xthrow` (default); only +nothrow ones, with :switch:`-fhardcfr-check-noreturn-calls=nothrow`; +or none, with :switch:`-fhardcfr-check-noreturn-calls=never`. When a No_Return call returns control to its caller through an exception, verification may have already been performed before the -call, if :switch:`-fhardcfr-check-noreturn-calls=always` is in effect. -The compiler arranges for already-checked No_Return calls without a +call, if :switch:`-fhardcfr-check-noreturn-calls=always` or +:switch:`-fhardcfr-check-noreturn-calls=no-xthrow` is in effect. The +compiler arranges for already-checked No_Return calls without a preexisting handler to bypass the implicitly-added cleanup handler and thus the redundant check, but a local exception or cleanup handler, if present, will modify the set of visited blocks, and checking will take diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 817ba0b9108..988bb779105 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -29634,17 +29634,18 @@ exception end; @end example -Verification may also be performed before No_Return calls, whether -only nothrow ones, with -@code{-fhardcfr-check-noreturn-calls=nothrow}, or all of them, with -@code{-fhardcfr-check-noreturn-calls=always}. The default is -@code{-fhardcfr-check-noreturn-calls=never} for this feature, that -disables checking before No_Return calls. +Verification may also be performed before No_Return calls, whether all +of them, with @code{-fhardcfr-check-noreturn-calls=always}; all but +internal subprograms involved in exception-raising or -reraising, with +@code{-fhardcfr-check-noreturn-calls=no-xthrow} (default); only +nothrow ones, with @code{-fhardcfr-check-noreturn-calls=nothrow}; +or none, with @code{-fhardcfr-check-noreturn-calls=never}. When a No_Return call returns control to its caller through an exception, verification may have already been performed before the -call, if @code{-fhardcfr-check-noreturn-calls=always} is in effect. -The compiler arranges for already-checked No_Return calls without a +call, if @code{-fhardcfr-check-noreturn-calls=always} or +@code{-fhardcfr-check-noreturn-calls=no-xthrow} is in effect. The +compiler arranges for already-checked No_Return calls without a preexisting handler to bypass the implicitly-added cleanup handler and thus the redundant check, but a local exception or cleanup handler, if present, will modify the set of visited blocks, and checking will take