public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: "Tsimbalist, Igor V" <igor.v.tsimbalist@intel.com>,
	Uros Bizjak	<ubizjak@gmail.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: 0005-Part-5.-Add-x86-CET-documentation
Date: Fri, 29 Sep 2017 05:15:00 -0000	[thread overview]
Message-ID: <59CDD6E3.3040309@codesourcery.com> (raw)
In-Reply-To: <D511F25789BA7F4EBA64C8A63891A0028ADB9CC9@irsmsx105.ger.corp.intel.com>

On 09/27/2017 09:17 AM, Tsimbalist, Igor V wrote:
> Updated version #3.
>
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index e52a1ea..accba40 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -5655,6 +5655,14 @@ compiled with the @option{-fcf-protection=branch} option.  The
>  compiler assumes that the function's address is a valid target for a
>  control-flow transfer.
>
> +@emph{x86 implementation:} when @option{-fcf-protection} option is
> +specified the compiler inserts an @code{endbr} instruction at function's
> +prologue if the function's type does not have the @code{nocf_check}
> +attribute and addresses to which indirect control-flow transfer can
> +happen.  The instruction triggers the HW check if a control-flow
> +transfer to the address where @code{endbr} instruction was inserted
> +is valid.
> +

I think the consensus among Joseph, Jeff, and I is that this doesn't 
belong in the GCC manual at all, but in the ABI documentation.  So 
please delete the implementation note.

> @@ -5662,7 +5670,9 @@ not be instrumented when compiled with the
>  that the function's address from the pointer is a valid target for
>  a control-flow transfer.  A direct function call through a function
>  name is assumed to be a safe call thus direct calls are not
> -instrumented by the compiler.
> +instrumented by the compiler.  For @emph{x86 implementation} the
> +compiler inserts a @code{notrack} prefix before an indirect call
> +instruction.

Ditto with this implementation note.

> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index c4faa23..189130b 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -1203,6 +1203,7 @@ See RS/6000 and PowerPC Options.
>  -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
>  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mlwp  -mmpx  @gol
>  -mmwaitx  -mclzero  -mpku  -mthreads @gol
> +-mcet -mibt -mshstk @gol
>  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
>  -minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
>  -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
> @@ -11374,6 +11375,14 @@ You can also use the @code{nocf_check} attribute to identify
>  which functions and calls should be skipped from instrumentation
>  (@pxref{Function Attributes}).
>
> +Currently the x86 GNU/Linux target provides an implementation based
> +on Intel Control-flow Enforcement Technology (CET).  Instrumentation
> +for x86 is controlled by target-specific options @option{-mcet},
> +@option{-mibt} and @option{-mshstk} (@pxref{x86 Options}).

This part is OK.

> +The compiler also provides a number of built-in functions for
> +fine-grained control in a CET-based application.
> +See @xref{x86 Built-in Functions}, for more information.

I think these builtins emit instructions in the CET extension explicitly 
and don't affect the GCC's code generation for the -fcf-protection 
option.  So please move this to the discussion of -mcet in the x86 
options section instead....

> @@ -25779,6 +25792,11 @@ supported architecture, using the appropriate flags.  In particular,
>  the file containing the CPU detection code should be compiled without
>  these options.
>
> +The @option{-mcet} option turns on the @option{-mibt} and @option{-mshstk}
> +options.  The @option{-mibt} option enables indirect branch tracking support
> +and the @option{-mshstk} option enables shadow stack support from
> +Intel Control-flow Enforcement Technology (CET).
> +

...here.

The patch is OK with those changes.

-Sandra

      parent reply	other threads:[~2017-09-29  5:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  8:57 0005-Part-5.-Add-x86-CET-documentation Tsimbalist, Igor V
2017-09-20  9:21 ` 0005-Part-5.-Add-x86-CET-documentation Tsimbalist, Igor V
2017-09-20 14:13   ` 0005-Part-5.-Add-x86-CET-documentation Uros Bizjak
2017-09-25  3:43     ` 0005-Part-5.-Add-x86-CET-documentation Sandra Loosemore
2017-09-26 13:47       ` 0005-Part-5.-Add-x86-CET-documentation Tsimbalist, Igor V
2017-09-27  3:40         ` 0005-Part-5.-Add-x86-CET-documentation Sandra Loosemore
2017-09-27  8:52           ` 0005-Part-5.-Add-x86-CET-documentation Florian Weimer
2017-09-27 11:52             ` 0005-Part-5.-Add-x86-CET-documentation Tsimbalist, Igor V
2017-09-27 16:48             ` 0005-Part-5.-Add-x86-CET-documentation Sandra Loosemore
2017-09-27 17:01             ` 0005-Part-5.-Add-x86-CET-documentation Joseph Myers
2017-09-28 23:29               ` 0005-Part-5.-Add-x86-CET-documentation Jeff Law
2017-09-27 15:17           ` 0005-Part-5.-Add-x86-CET-documentation Tsimbalist, Igor V
2017-09-28 23:32             ` 0005-Part-5.-Add-x86-CET-documentation Jeff Law
2017-09-29  5:15             ` Sandra Loosemore [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59CDD6E3.3040309@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=igor.v.tsimbalist@intel.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).