[Bug other/89701] Provide -fcf-protection=branch,return

2021-01-12 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

--- Comment #3 from Hongtao.liu  ---
(In reply to Hongtao.liu from comment #2)
> (In reply to Marek Polacek from comment #1)
> > Confirmed.  While we support -fcf-protection=branch and
> > -fcf-protection=return,
> > -fcf-protection=branch,return gives an error:
> > 
> > xgcc: error: unknown Control-Flow Protection Level ‘branch,return’
> > xgcc: note: valid arguments to ‘-fcf-protection=’ are: branch check full
> > none retur
> 
> We can add a new EnumValue with string (branch,return) and value ({(enum
> cf_protection_level) (CF_BRANCH | CF_RETURN)}) for this specific case,  but
> the implementation is too cumbersome considering the many permutations
> possible.
> 
> Another way is adding parser_cf_protection_options, called in
> parse_sanitizer_options, decoding the string value and set corresponding bit
> in flag_cf_protection.

called in common_handle_option

[Bug other/89701] Provide -fcf-protection=branch,return

2021-01-12 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

--- Comment #2 from Hongtao.liu  ---
(In reply to Marek Polacek from comment #1)
> Confirmed.  While we support -fcf-protection=branch and
> -fcf-protection=return,
> -fcf-protection=branch,return gives an error:
> 
> xgcc: error: unknown Control-Flow Protection Level ‘branch,return’
> xgcc: note: valid arguments to ‘-fcf-protection=’ are: branch check full
> none retur

We can add a new EnumValue with string (branch,return) and value ({(enum
cf_protection_level) (CF_BRANCH | CF_RETURN)}) for this specific case,  but the
implementation is too cumbersome considering the many permutations possible.

Another way is adding parser_cf_protection_options, called in
parse_sanitizer_options, decoding the string value and set corresponding bit in
flag_cf_protection.

[Bug other/89701] Provide -fcf-protection=branch,return

2021-01-11 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org
   Last reconfirmed||2021-01-11
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #1 from Marek Polacek  ---
Confirmed.  While we support -fcf-protection=branch and -fcf-protection=return,
-fcf-protection=branch,return gives an error:

xgcc: error: unknown Control-Flow Protection Level ‘branch,return’
xgcc: note: valid arguments to ‘-fcf-protection=’ are: branch check full none
retur