On Wed, Nov 17, 2021 at 12:09 PM Uros Bizjak wrote: > > On Wed, Nov 17, 2021 at 9:02 PM H.J. Lu wrote: > > > > On Wed, Nov 17, 2021 at 7:53 AM Uros Bizjak wrote: > > > > > > On Wed, Nov 17, 2021 at 4:35 PM H.J. Lu wrote: > > > > > > > > Add -mharden-sls= to mitigate against straight line speculation (SLS) > > > > for function return and indirect branch by adding an INT3 instruction > > > > after function return and indirect branch. > > > > > > > > gcc/ > > > > > > > > PR target/102952 > > > > * config/i386/i386-opts.h (harden_sls): New enum. > > > > * config/i386/i386.c (output_indirect_thunk): Mitigate against > > > > SLS for function return. > > > > (ix86_output_function_return): Likewise. > > > > (ix86_output_jmp_thunk_or_indirect): Mitigate against indirect > > > > branch. > > > > (ix86_output_indirect_jmp): Likewise. > > > > (ix86_output_call_insn): Likewise. > > > > * config/i386/i386.opt: Add -mharden-sls=. > > > > * doc/invoke.texi: Document -mharden-sls=. > > > > > > > > gcc/testsuite/ > > > > > > > > PR target/102952 > > > > * gcc.target/i386/harden-sls-1.c: New test. > > > > * gcc.target/i386/harden-sls-2.c: Likewise. > > > > * gcc.target/i386/harden-sls-3.c: Likewise. > > > > * gcc.target/i386/harden-sls-4.c: Likewise. > > > > * gcc.target/i386/harden-sls-5.c: Likewise. > > OK, with a small nit below. > > Thanks, > Uros. > > +mharden-sls= > +Target RejectNegative Joined Enum(harden_sls) Var(ix86_harden_sls) > Init(harden_sls_none) > +Generate code to mitigate against straight line speculation. > + > +Enum > +Name(harden_sls) Type(enum harden_sls) > +Known choices for mitigation against straight line speculation with > -mharden-sls=: > + > +EnumValue > +Enum(harden_sls) String(none) Value(harden_sls_none) > + > +EnumValue > +Enum(harden_sls) String(all) Value(harden_sls_all) > > Please move the above enum to the last enum. > > + > +EnumValue > +Enum(harden_sls) String(return) Value(harden_sls_return) > + > +EnumValue > +Enum(harden_sls) String(indirect-branch) Value(harden_sls_indirect_branch) > + This is the v4 patch I am checking in. Thanks. -- H.J.