From: Jan Hubicka <hubicka@ucw.cz>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Improve DSE to handle stores before __builtin_unreachable ()
Date: Thu, 22 Jun 2023 15:42:33 +0200 [thread overview]
Message-ID: <ZJRPyeuKxXHfI/2e@kam.mff.cuni.cz> (raw)
In-Reply-To: <b26de798-7467-e385-abee-164296204316@gmail.com>
>
>
> On 6/22/23 00:31, Richard Biener wrote:
> > I think there's a difference in that __builtin_trap () is observable
> > while __builtin_unreachable () is not and reaching __builtin_unreachable
> > () invokes undefined behavior while reaching __builtin_trap () does not.
> >
> > So the isolation code marking the trapping code volatile should be
> > enough and the trap () is just there to end the basic block
> > (and maybe be on the safe side to really trap).
> Agreed WRT observability -- but that's not really the point of the trap and
> if we wanted we could change that behavior.
>
> The trap is there to halt execution immediately rather than letting it keep
> running. That was a design decision from a security standpoint. If we've
> detected that we're executing undefined behavior, stop rather than
> potentially letting a malicious actor turn a bug into an exploit.
Also as discussed some time ago, the volatile loads between traps has
effect of turning previously pure/const functions into non-const which
is somewhat sad, so it is still on my todo list to change it this stage1
to something more careful. We discussed internal functions trap_store
and trap_load which will expand to load/store + trap but will make it
clear that side effect does not count to modref.
I wanted to give it some time if I can come with something better, but
didn't so far.
Honza
next prev parent reply other threads:[~2023-06-22 13:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230620070009.C11983858D1E@sourceware.org>
2023-06-20 13:27 ` Jeff Law
2023-06-21 6:41 ` Richard Biener
2023-06-21 9:55 ` Jan Hubicka
2023-06-21 14:04 ` Jeff Law
2023-06-22 6:31 ` Richard Biener
2023-06-22 13:36 ` Jeff Law
2023-06-22 13:42 ` Jan Hubicka [this message]
2023-06-24 14:24 ` Jeff Law
2023-06-25 16:33 ` Jan Hubicka
2023-06-26 17:21 ` Jan Hubicka
2023-06-26 22:37 ` Jeff Law
2023-06-20 6:59 Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZJRPyeuKxXHfI/2e@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).