From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id EF5233856DE7 for ; Wed, 18 May 2022 17:28:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EF5233856DE7 Received: by mail-pl1-x635.google.com with SMTP id bh5so2420066plb.6 for ; Wed, 18 May 2022 10:28:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XEQY7Lkovi5CTwespY9GX/MZbR1d+pwP4dSHmGIg7Sc=; b=dO/FrVYuxi69+fDzd3VOqDGM/3ZLMM+CQUm+f3o0szb9buQe5vuvb/T9ndYzOw8C4T eL9wh92zR9mCRd7fjeWrcypsNdGQSoZ7JQyXIgDdFhDkyqGC8LMLNvwtp5bXWlfQqQH4 PsU9GNLbXaZ71ok+j+nAU4EZSxF9b/Ghu1UtWRnTlzaVPcdQ8e+uzKZJZ8MvRI8Shm6p UyTRsf5o4JVAJhcIDieHFsEsXhrJE3tckVuHmmJ8H3XQB3wYGh3IlIda9TLdA6cZWF6H DdGoQz+CMnjsFozPnVN13nu0CppTPe9tXFxYiVEQlZ1BiIOBTkX+E038qkPoCIlNj84L 66Ng== X-Gm-Message-State: AOAM530NGc0weVzHvE+dw0rnxnU1fc4r6H3gS1xnE+K2Q790ZbZ7MM4r gCbyye0BqGt8T+o8maEm5VZJA1wR6Dg3CtpmN5kWOrMK X-Google-Smtp-Source: ABdhPJzBOeS6uTFQP/j5T73u0PbxxzGkeqkoBOAbKA6giTEImLifb95XSwwdhuvJZZy3jpkH9949Nbpscu/cRkSuBhQ= X-Received: by 2002:a17:902:988e:b0:161:8750:480b with SMTP id s14-20020a170902988e00b001618750480bmr457453plp.154.1652894900524; Wed, 18 May 2022 10:28:20 -0700 (PDT) MIME-Version: 1.0 References: <20220511205251.2947362-1-hjl.tools@gmail.com> In-Reply-To: <20220511205251.2947362-1-hjl.tools@gmail.com> From: "H.J. Lu" Date: Wed, 18 May 2022 10:27:44 -0700 Message-ID: Subject: Re: [PATCH v2] x86: Document -mcet-switch To: GCC Patches Cc: Uros Bizjak , Florian Weimer Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3025.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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, 18 May 2022 17:28:23 -0000 On Wed, May 11, 2022 at 1:52 PM H.J. Lu wrote: > > When -fcf-protection=branch is used, the compiler will generate jump > tables for switch statements where the indirect jump is prefixed with > the NOTRACK prefix, so it can jump to non-ENDBR targets. Since the > indirect jump targets are generated by the compiler, they are always > valid. > > Document -mcet-switch to generate jump tables for switch statements with > ENDBR and skip the NOTRACK prefix for indirect jump. This option should > be used when the NOTRACK prefix is disabled. > > PR target/104816 > * config/i386/i386.opt: Remove Undocumented. > * doc/invoke.texi: Document -mcet-switch. > --- > gcc/config/i386/i386.opt | 2 +- > gcc/doc/invoke.texi | 8 +++++++- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt > index a6b0e28f238..0dbaacb57ed 100644 > --- a/gcc/config/i386/i386.opt > +++ b/gcc/config/i386/i386.opt > @@ -1047,7 +1047,7 @@ Enable shadow stack built-in functions from Control-flow Enforcement > Technology (CET). > > mcet-switch > -Target Undocumented Var(flag_cet_switch) Init(0) > +Target Var(flag_cet_switch) Init(0) > Turn on CET instrumentation for switch statements that use a jump table and > an indirect jump. > > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 7a35d9613a4..968853690f9 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -1420,7 +1420,8 @@ See RS/6000 and PowerPC Options. > -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol > -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol > -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol > --mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol > +-mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call @gol > +-mavx512vbmi2 -mavx512bf16 -menqcmd @gol > -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol > -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol > -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol > @@ -32641,6 +32642,11 @@ function attribute. This is useful when used with the option > @option{-fcf-protection=branch} to control ENDBR insertion at the > function entry. > > +@item -mcet-switch > +@opindex mcet-switch > +Turn on CET instrumentation for switch statements that use a jump table > +and an indirect jump. > + > @item -mcall-ms2sysv-xlogues > @opindex mcall-ms2sysv-xlogues > @opindex mno-call-ms2sysv-xlogues > -- > 2.35.1 > Any comments? Thanks. -- H.J.