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

2018-04-20 Thread Tsimbalist, Igor V
> -Original Message- > From: H.J. Lu [mailto:hjl.to...@gmail.com] > Sent: Friday, April 20, 2018 1:15 PM > To: Jakub Jelinek > Cc: Tsimbalist, Igor V ; Richard Biener > ; Uros Bizjak ; gcc- > patc...@gcc.gnu.org > Subject: Re: [PATCH] x86: Allow -fcf-protect

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 __CET__

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 pa

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 != CF

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

2018-04-19 Thread Tsimbalist, Igor V
> -Original Message- > From: H.J. Lu [mailto:hjl.to...@gmail.com] > Sent: Friday, April 20, 2018 3:17 AM > To: Jakub Jelinek > Cc: Tsimbalist, Igor V ; Richard Biener > ; Uros Bizjak ; gcc- > patc...@gcc.gnu.org > Subject: Re: [PATCH] x86: Allow -fcf-protect

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)) >> > +def_or_unde

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

2018-04-19 Thread Tsimbalist, Igor V
> -Original Message- > From: H.J. Lu [mailto:hjl.to...@gmail.com] > Sent: Friday, April 20, 2018 12:08 AM > To: Tsimbalist, Igor V > Cc: Jakub Jelinek ; Richard Biener > ; Uros Bizjak ; gcc- > patc...@gcc.gnu.org > Subject: Re: [PATCH] x86: Allow -fcf-protect

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

2018-04-19 Thread H.J. Lu
gt; Cc: Richard Biener ; Uros Bizjak >> ; gcc-patches@gcc.gnu.org; Tsimbalist, Igor V >> >> Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs >> >> On Thu, Apr 19, 2018 at 12:25 PM, Jakub Jelinek >> wrote: >> > On Thu, Ap

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

2018-04-19 Thread Tsimbalist, Igor V
or V > > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > 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): Al

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 @@ ix86_target_macros_interna

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 >> +++ b/gcc/config/i

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

2018-04-19 Thread Tsimbalist, Igor V
> -Original Message- > From: Uros Bizjak [mailto:ubiz...@gmail.com] > Sent: Thursday, April 19, 2018 3:36 PM > To: H.J. Lu > Cc: Richard Biener ; gcc- > patc...@gcc.gnu.org; Tsimbalist, Igor V > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOP

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, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >> >>> On Tue, Apr 17

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, Apr 17, 2018 at 12:25 PM, H.J. Lu wrote: >> >>> On Tue, Apr 17

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 Tue, Apr 17, 2018 at 12:03 PM, H.J. Lu wrote: > On Tue, Apr

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, 2018 at 4:55 AM, Uros Bizjak wrote: >>>

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 > >>> +Target Report Var(flag_nop) Init(0)

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, 2018 at 1:39 PM, H.J. Lu wrote: >> >

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

2018-04-18 Thread Tsimbalist, Igor V
or > V > 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, 2018 at 04:57:41AM -0700, H.J. Lu wrote: > > > On Wed, Apr 18, 2018 at 4:55 AM, Uros Bizjak > wrote: > &

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

2018-04-18 Thread Tsimbalist, Igor V
: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > 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:2

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: >>> >> 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 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 patch to add -mnop and use it with -fcf-

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. +mnop +Target Report Var(flag_nop) Init(0) +Support

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 code generation. >>> >>> the option name is

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 doesn't make it >> better

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 wrote: On Tue, Apr 17, 2018 at 12:03 PM, H.J. Lu wrote: > On Tue, Apr 17, 2018 at

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: On Tue, Apr 17, 2018 at 11:55 AM, Uros Bizjak wrote: > On Tue, Apr 17, 2018 at 8:

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: On Tue, Apr 17, 2018 at 8:42 PM, H.J. Lu wrote: > -fcf-protection -mcet can'

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 >>> multiversioning or target clone, since IBT/SHSTK are applied to

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: -fcf-protection -mcet can't be used with IFUNC features, like symbol multiver

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 >> program and they may be disabled in some f

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 implemented with multi-