From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id B3D08385114A for ; Wed, 13 Jul 2022 10:02:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B3D08385114A Received: by mail-ej1-x629.google.com with SMTP id sz17so18933059ejc.9 for ; Wed, 13 Jul 2022 03:02:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=wIy4yluJEaf+RV1yPdWQcJuDrn3nUMCtp2wQ8bZ/kC8=; b=Zb2E1WspRlwIesr7IUf+9OfD9SPLfk/Fu3kDxwj2VeDNx/RU87hgMpn/FyOSKHfjNq 577t3shaJ/bPTj9lHryXCczkbk66lf/VpdfXhk6Z2gz11tlI++bxKu8LJPwMTXVbO2JJ Fm0832bcSQyw+9wujuW+ZDQig7zJiWlhW+1uMVt34KSbUUTMhyBLgewe3Bsyx6SWHmx9 UbdEh08X/0B4ZNf7IcPABhG32cstnIheRM+T16o4cPFbCOLvm92wfD1jcp0Edc4dFzh/ 9p0n56DzHS3Tyx2Ud3vj9edEH7veiWRolKkztqsjDkOdaaTEwGJFizSo0iLI+Z+oQF1k VyLw== X-Gm-Message-State: AJIora8/4tnPGNITwPW4sgzRlsktk3I18NC/1nZMfd9VIlZVcdXc/XWg 7n2+wSJNm7lxpncnhvBjZWDC/Pe8jVjXyQ== X-Google-Smtp-Source: AGRyM1tW5vOlLXV++ey2nWtCesO+UM2knsixEYPXmxbMlqnzasv1ILH9b13lZO5xZK2pmomB9gfzew== X-Received: by 2002:a17:907:2e0d:b0:72b:8cd4:ca52 with SMTP id ig13-20020a1709072e0d00b0072b8cd4ca52mr2470960ejc.541.1657706575518; Wed, 13 Jul 2022 03:02:55 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id i20-20020a170906a29400b0072a881b21d8sm4763955ejz.119.2022.07.13.03.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 03:02:55 -0700 (PDT) Date: Wed, 13 Jul 2022 10:02:54 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Alexandre Oliva Subject: [Ada] Clarify hardening command-line options that require explicit choices Message-ID: <20220713100254.GA994647@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline X-Spam-Status: No, score=-13.2 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-List-Received-Date: Wed, 13 Jul 2022 10:02:59 -0000 --J/dobhs11T7y2rNN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Prefixes -fzero-call-used-regs and -fstrub could be mistaken for full command-line options with the references to them in the GNAT RM. Make it clearer that they require explicit choices. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_rm/security_hardening_features.rst: Clarify the need for choices after -fzero-call-used-regs and -fstrub. * gnat_rm.texi: Regenerate. --J/dobhs11T7y2rNN Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/doc/gnat_rm/security_hardening_features.rst b/gcc/ada/doc/gnat_rm/security_hardening_features.rst --- a/gcc/ada/doc/gnat_rm/security_hardening_features.rst +++ b/gcc/ada/doc/gnat_rm/security_hardening_features.rst @@ -18,9 +18,10 @@ Register Scrubbing GNAT can generate code to zero-out hardware registers before returning from a subprogram. -It can be enabled with the :switch:`-fzero-call-used-regs` command-line -option, to affect all subprograms in a compilation, and with a -:samp:`Machine_Attribute` pragma, to affect only specific subprograms. +It can be enabled with the :switch:`-fzero-call-used-regs={choice}` +command-line option, to affect all subprograms in a compilation, and +with a :samp:`Machine_Attribute` pragma, to affect only specific +subprograms. .. code-block:: ada @@ -73,11 +74,11 @@ or a variable.) -- scrubbing of the stack space used by that subprogram. -There are also :switch:`-fstrub` command-line options to control -default settings. For usage and more details on the command-line -option, on the ``strub`` attribute, and their use with other -programming languages, see :title:`Using the GNU Compiler Collection -(GCC)`. +There are also :switch:`-fstrub={choice}` command-line options to +control default settings. For usage and more details on the +command-line options, on the ``strub`` attribute, and their use with +other programming languages, see :title:`Using the GNU Compiler +Collection (GCC)`. Note that Ada secondary stacks are not scrubbed. The restriction ``No_Secondary_Stack`` avoids their use, and thus their accidental diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -21,7 +21,7 @@ @copying @quotation -GNAT Reference Manual , Jun 24, 2022 +GNAT Reference Manual , Jul 11, 2022 AdaCore @@ -28922,9 +28922,10 @@ change. GNAT can generate code to zero-out hardware registers before returning from a subprogram. -It can be enabled with the @code{-fzero-call-used-regs} command-line -option, to affect all subprograms in a compilation, and with a -@code{Machine_Attribute} pragma, to affect only specific subprograms. +It can be enabled with the @code{-fzero-call-used-regs=@emph{choice}} +command-line option, to affect all subprograms in a compilation, and +with a @code{Machine_Attribute} pragma, to affect only specific +subprograms. @example procedure Foo; @@ -28975,10 +28976,10 @@ pragma Machine_Attribute (Var, "strub"); -- scrubbing of the stack space used by that subprogram. @end example -There are also @code{-fstrub} command-line options to control -default settings. For usage and more details on the command-line -option, on the @code{strub} attribute, and their use with other -programming languages, see @cite{Using the GNU Compiler Collection (GCC)}. +There are also @code{-fstrub=@emph{choice}} command-line options to +control default settings. For usage and more details on the +command-line options, on the @code{strub} attribute, and their use with +other programming languages, see @cite{Using the GNU Compiler Collection (GCC)}. Note that Ada secondary stacks are not scrubbed. The restriction @code{No_Secondary_Stack} avoids their use, and thus their accidental --J/dobhs11T7y2rNN--