public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/89701] Provide -fcf-protection=branch,return
       [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
@ 2021-01-11 20:30 ` mpolacek at gcc dot gnu.org
  2021-01-12  9:04 ` crazylht at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-11 20:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

Marek Polacek <mpolacek at gcc dot gnu.org> 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 <mpolacek at gcc dot gnu.org> ---
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/89701] Provide -fcf-protection=branch,return
       [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
  2021-01-11 20:30 ` [Bug other/89701] Provide -fcf-protection=branch,return mpolacek at gcc dot gnu.org
@ 2021-01-12  9:04 ` crazylht at gmail dot com
  2021-01-12  9:53 ` crazylht at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: crazylht at gmail dot com @ 2021-01-12  9:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
(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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/89701] Provide -fcf-protection=branch,return
       [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
  2021-01-11 20:30 ` [Bug other/89701] Provide -fcf-protection=branch,return mpolacek at gcc dot gnu.org
  2021-01-12  9:04 ` crazylht at gmail dot com
@ 2021-01-12  9:53 ` crazylht at gmail dot com
  2021-01-26  6:36 ` [Bug target/89701] " crazylht at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: crazylht at gmail dot com @ 2021-01-12  9:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
(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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/89701] Provide -fcf-protection=branch,return
       [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-01-12  9:53 ` crazylht at gmail dot com
@ 2021-01-26  6:36 ` crazylht at gmail dot com
  2021-05-04 12:32 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: crazylht at gmail dot com @ 2021-01-26  6:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
Created attachment 50051
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50051&action=edit
tested patch based on latest trunk

Will send patch in GCC12.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/89701] Provide -fcf-protection=branch,return
       [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-01-26  6:36 ` [Bug target/89701] " crazylht at gmail dot com
@ 2021-05-04 12:32 ` rguenth at gcc dot gnu.org
  2023-07-21  3:07 ` cvs-commit at gcc dot gnu.org
  2023-07-21  3:10 ` crazylht at gmail dot com
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/89701] Provide -fcf-protection=branch,return
       [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-05-04 12:32 ` rguenth at gcc dot gnu.org
@ 2023-07-21  3:07 ` cvs-commit at gcc dot gnu.org
  2023-07-21  3:10 ` crazylht at gmail dot com
  6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-21  3:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:1c6231c05bdccab3a21abcbb75e2094ea3e98782

commit r14-2692-g1c6231c05bdccab3a21abcbb75e2094ea3e98782
Author: liuhongt <hongtao.liu@intel.com>
Date:   Fri May 12 15:15:08 2023 +0800

    Provide -fcf-protection=branch,return.

    Use EnumSet instead of EnumBitSet since CF_FULL is not power of 2.
    It is a bit tricky for sets classification, cf_branch and cf_return
    should be in different sets, but they both "conflicts" cf_full,
    cf_none. And current EnumSet don't handle this well.

    So in the current implementation, only cf_full,cf_none are exclusive
    to each other, but they can be combined with any cf_branch, cf_return,
    cf_check. It's not perfect, but still an improvement than original
    one.

    gcc/ChangeLog:

            PR target/89701
            * common.opt: (fcf-protection=): Add EnumSet attribute to
            support combination of params.

    gcc/testsuite/ChangeLog:

            * c-c++-common/fcf-protection-10.c: New test.
            * c-c++-common/fcf-protection-11.c: New test.
            * c-c++-common/fcf-protection-12.c: New test.
            * c-c++-common/fcf-protection-8.c: New test.
            * c-c++-common/fcf-protection-9.c: New test.
            * gcc.target/i386/pr89701-1.c: New test.
            * gcc.target/i386/pr89701-2.c: New test.
            * gcc.target/i386/pr89701-3.c: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/89701] Provide -fcf-protection=branch,return
       [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2023-07-21  3:07 ` cvs-commit at gcc dot gnu.org
@ 2023-07-21  3:10 ` crazylht at gmail dot com
  6 siblings, 0 replies; 7+ messages in thread
From: crazylht at gmail dot com @ 2023-07-21  3:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89701

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC14.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-21  3:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89701-4@http.gcc.gnu.org/bugzilla/>
2021-01-11 20:30 ` [Bug other/89701] Provide -fcf-protection=branch,return mpolacek at gcc dot gnu.org
2021-01-12  9:04 ` crazylht at gmail dot com
2021-01-12  9:53 ` crazylht at gmail dot com
2021-01-26  6:36 ` [Bug target/89701] " crazylht at gmail dot com
2021-05-04 12:32 ` rguenth at gcc dot gnu.org
2023-07-21  3:07 ` cvs-commit at gcc dot gnu.org
2023-07-21  3:10 ` crazylht at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).