RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-20 Thread Tsimbalist, Igor V
Uros Bizjak <ubiz...@gmail.com>; gcc- > patc...@gcc.gnu.org > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Fri, Apr 20, 2018 at 09:39:58AM +0200, Jakub Jelinek wrote: > > On Fri, Apr 20, 2018 at 06:25:10AM +, Tsimbalist, Igor

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-20 Thread H.J. Lu
On Fri, Apr 20, 2018 at 09:39:58AM +0200, Jakub Jelinek wrote: > On Fri, Apr 20, 2018 at 06:25:10AM +, Tsimbalist, Igor V wrote: > > > Something like this? > > > > Shouldn't this > > > > -# ifdef __IBT__ > > +# if (__CET__ & 1) != 0 > > > > Be as > > > > -# ifdef __IBT__ > > +#ifdef

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-20 Thread Jakub Jelinek
On Fri, Apr 20, 2018 at 06:25:10AM +, Tsimbalist, Igor V wrote: > > Something like this? > > Shouldn't this > > -# ifdef __IBT__ > +# if (__CET__ & 1) != 0 > > Be as > > -# ifdef __IBT__ > +#ifdef __CET__ > +# if (__CET__ & 1) != 0 > > OK otherwise. Only if you use -Wundef warning (not

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-20 Thread Jakub Jelinek
On Thu, Apr 19, 2018 at 03:08:06PM -0700, H.J. Lu wrote: > > As -fcf-protection and -mcet/-mibt/-mshstk are are disjoint and > > control different parts I agree with > > > > + if ((isa_flag & OPTION_MASK_ISA_SHSTK)) > > +def_or_undef (parse_in, "__SHSTK__"); > > + if (flag_cf_protection !=

RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-20 Thread Tsimbalist, Igor V
Uros Bizjak <ubiz...@gmail.com>; gcc- > patc...@gcc.gnu.org > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Thu, Apr 19, 2018 at 3:37 PM, Jakub Jelinek <ja...@redhat.com> wrote: > > On Thu, Apr 19, 2018 at 03:08:06PM -0700, H.J. Lu wrote:

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread H.J. Lu
On Thu, Apr 19, 2018 at 3:37 PM, Jakub Jelinek wrote: > On Thu, Apr 19, 2018 at 03:08:06PM -0700, H.J. Lu wrote: >> > As -fcf-protection and -mcet/-mibt/-mshstk are are disjoint and >> > control different parts I agree with >> > >> > + if ((isa_flag & OPTION_MASK_ISA_SHSTK)) >>

RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread Tsimbalist, Igor V
Uros Bizjak <ubiz...@gmail.com>; gcc- > patc...@gcc.gnu.org > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Thu, Apr 19, 2018 at 2:18 PM, Tsimbalist, Igor V > <igor.v.tsimbal...@intel.com> wrote: > >> -Original Message---

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread H.J. Lu
02 PM >> To: Jakub Jelinek <ja...@redhat.com> >> Cc: Richard Biener <richard.guent...@gmail.com>; Uros Bizjak >> <ubiz...@gmail.com>; gcc-patches@gcc.gnu.org; Tsimbalist, Igor V >> <igor.v.tsimbal...@intel.com> >> Subject: Re: [PATCH] x86: Allow -fcf-p

RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread Tsimbalist, Igor V
os Bizjak > <ubiz...@gmail.com>; gcc-patches@gcc.gnu.org; Tsimbalist, Igor V > <igor.v.tsimbal...@intel.com> > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Thu, Apr 19, 2018 at 12:25 PM, Jakub Jelinek <ja...@redhat.com> >

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread Jakub Jelinek
On Thu, Apr 19, 2018 at 06:30:37AM -0700, H.J. Lu wrote: > * config/i386/i386-c.c (ix86_target_macros_internal): Also > define __IBT__ and __SHSTK__ for -fcf-protection. > --- a/gcc/config/i386/i386-c.c > +++ b/gcc/config/i386/i386-c.c > @@ -499,13 +499,15 @@

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread H.J. Lu
On Thu, Apr 19, 2018 at 12:25 PM, Jakub Jelinek wrote: > On Thu, Apr 19, 2018 at 06:30:37AM -0700, H.J. Lu wrote: >> * config/i386/i386-c.c (ix86_target_macros_internal): Also >> define __IBT__ and __SHSTK__ for -fcf-protection. > >> --- a/gcc/config/i386/i386-c.c >>

RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread Tsimbalist, Igor V
imbal...@intel.com> > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Thu, Apr 19, 2018 at 3:30 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > > On Wed, Apr 18, 2018 at 01:35:33PM +0200, Richard Biener wrote: > >> On Wed, Apr 18, 2018 at 1:24 PM

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread Richard Biener
On Thu, Apr 19, 2018 at 3:30 PM, H.J. Lu wrote: > On Wed, Apr 18, 2018 at 01:35:33PM +0200, Richard Biener wrote: >> On Wed, Apr 18, 2018 at 1:24 PM, H.J. Lu wrote: >> > On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >> >> On Tue,

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread Uros Bizjak
On Thu, Apr 19, 2018 at 3:30 PM, H.J. Lu wrote: > On Wed, Apr 18, 2018 at 01:35:33PM +0200, Richard Biener wrote: >> On Wed, Apr 18, 2018 at 1:24 PM, H.J. Lu wrote: >> > On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >> >> On Tue,

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-19 Thread H.J. Lu
On Wed, Apr 18, 2018 at 01:35:33PM +0200, Richard Biener wrote: > On Wed, Apr 18, 2018 at 1:24 PM, H.J. Lu wrote: > > On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: > >> On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: > >>> On

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread H.J. Lu
On Wed, Apr 18, 2018 at 5:32 AM, Uros Bizjak wrote: > On Wed, Apr 18, 2018 at 2:09 PM, Jakub Jelinek wrote: >> On Wed, Apr 18, 2018 at 02:04:50PM +0200, Jakub Jelinek wrote: >>> On Wed, Apr 18, 2018 at 04:57:41AM -0700, H.J. Lu wrote: >>> > On Wed, Apr 18,

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Jakub Jelinek
On Wed, Apr 18, 2018 at 04:57:41AM -0700, H.J. Lu wrote: > On Wed, Apr 18, 2018 at 4:55 AM, Uros Bizjak wrote: > > On Wed, Apr 18, 2018 at 1:39 PM, H.J. Lu wrote: > > > Here is a patch to add -mnop and use it with -fcf-protection. > >>> > >>> +mnop >

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Uros Bizjak
On Wed, Apr 18, 2018 at 2:09 PM, Jakub Jelinek wrote: > On Wed, Apr 18, 2018 at 02:04:50PM +0200, Jakub Jelinek wrote: >> On Wed, Apr 18, 2018 at 04:57:41AM -0700, H.J. Lu wrote: >> > On Wed, Apr 18, 2018 at 4:55 AM, Uros Bizjak wrote: >> > > On Wed, Apr 18,

RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Tsimbalist, Igor V
> <richard.guent...@gmail.com>; gcc-patches@gcc.gnu.org; Tsimbalist, Igor > V <igor.v.tsimbal...@intel.com> > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Wed, Apr 18, 2018 at 02:04:50PM +0200, Jakub Jelinek wrote: > > On Wed, Apr 18

RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Tsimbalist, Igor V
atches@gcc.gnu.org; Tsimbalist, > Igor V <igor.v.tsimbal...@intel.com> > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Wed, Apr 18, 2018 at 4:35 AM, Richard Biener > <richard.guent...@gmail.com> wrote: > > On Wed, Apr 18, 2018 at 1:24 PM,

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread H.J. Lu
On Wed, Apr 18, 2018 at 5:08 AM, Uros Bizjak wrote: > On Wed, Apr 18, 2018 at 1:57 PM, H.J. Lu wrote: >> On Wed, Apr 18, 2018 at 4:55 AM, Uros Bizjak wrote: >>> On Wed, Apr 18, 2018 at 1:39 PM, H.J. Lu wrote: >>>

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Jakub Jelinek
On Wed, Apr 18, 2018 at 02:04:50PM +0200, Jakub Jelinek wrote: > On Wed, Apr 18, 2018 at 04:57:41AM -0700, H.J. Lu wrote: > > On Wed, Apr 18, 2018 at 4:55 AM, Uros Bizjak wrote: > > > On Wed, Apr 18, 2018 at 1:39 PM, H.J. Lu wrote: > > > > > Here is a

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Uros Bizjak
On Wed, Apr 18, 2018 at 1:57 PM, H.J. Lu wrote: > On Wed, Apr 18, 2018 at 4:55 AM, Uros Bizjak wrote: >> On Wed, Apr 18, 2018 at 1:39 PM, H.J. Lu wrote: >> > Here is a patch to add -mnop and use it with -fcf-protection.

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread H.J. Lu
On Wed, Apr 18, 2018 at 4:55 AM, Uros Bizjak wrote: > On Wed, Apr 18, 2018 at 1:39 PM, H.J. Lu wrote: > Here is a patch to add -mnop and use it with -fcf-protection. >>> >>> +mnop >>> +Target Report Var(flag_nop) Init(0) >>> +Support multi-byte NOP

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Uros Bizjak
On Wed, Apr 18, 2018 at 1:39 PM, H.J. Lu wrote: >>> Here is a patch to add -mnop and use it with -fcf-protection. >> >> +mnop >> +Target Report Var(flag_nop) Init(0) >> +Support multi-byte NOP code generation. >> >> the option name is incredibly bad and the documentation

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread H.J. Lu
On Wed, Apr 18, 2018 at 4:35 AM, Richard Biener wrote: > On Wed, Apr 18, 2018 at 1:24 PM, H.J. Lu wrote: >> On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >>> On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread Richard Biener
On Wed, Apr 18, 2018 at 1:24 PM, H.J. Lu wrote: > On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >> On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >>> On Tue, Apr 17, 2018 at 12:03 PM, H.J. Lu wrote:

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-18 Thread H.J. Lu
On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: > On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >> On Tue, Apr 17, 2018 at 12:03 PM, H.J. Lu wrote: >>> On Tue, Apr 17, 2018 at 11:55 AM, Uros Bizjak wrote:

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-17 Thread H.J. Lu
On Tue, Apr 17, 2018 at 12:03 PM, H.J. Lu wrote: > On Tue, Apr 17, 2018 at 11:55 AM, Uros Bizjak wrote: >> On Tue, Apr 17, 2018 at 8:42 PM, H.J. Lu wrote: >>> -fcf-protection -mcet can't be used with IFUNC features, like symbol >>>

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-17 Thread H.J. Lu
On Tue, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: > On Tue, Apr 17, 2018 at 12:03 PM, H.J. Lu wrote: >> On Tue, Apr 17, 2018 at 11:55 AM, Uros Bizjak wrote: >>> On Tue, Apr 17, 2018 at 8:42 PM, H.J. Lu wrote:

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-17 Thread H.J. Lu
On Tue, Apr 17, 2018 at 11:55 AM, Uros Bizjak wrote: > On Tue, Apr 17, 2018 at 8:42 PM, H.J. Lu wrote: >> -fcf-protection -mcet can't be used with IFUNC features, like symbol >> multiversioning or target clone, since IBT/SHSTK are applied to the whole >>

Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs

2018-04-17 Thread Uros Bizjak
On Tue, Apr 17, 2018 at 8:42 PM, H.J. Lu wrote: > -fcf-protection -mcet can't be used with IFUNC features, like symbol > multiversioning or target clone, since IBT/SHSTK are applied to the whole > program and they may be disabled in some functions. But -fcf-protection > is