public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-10000] asan: Don't instrument .ABNORMAL_DISPATCHER [PR114743] Date: Wed, 17 Apr 2024 08:24:50 +0000 (GMT) [thread overview] Message-ID: <20240417082450.77DA93858D20@sourceware.org> (raw) https://gcc.gnu.org/g:299d14a54672a4d12c1abbe4031a732bb56cddaa commit r14-10000-g299d14a54672a4d12c1abbe4031a732bb56cddaa Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Apr 17 10:24:18 2024 +0200 asan: Don't instrument .ABNORMAL_DISPATCHER [PR114743] .ABNORMAL_DISPATCHER is currently the only internal function with ECF_NORETURN, and asan likes to instrument ECF_NORETURN calls by adding some builtin call before them, which breaks the .ABNORMAL_DISPATCHER discovery added in gsi_safe_*. The following patch fixes asan not to instrument .ABNORMAL_DISPATCHER calls, like it doesn't instrument a couple of specific builtin calls as well. 2024-04-17 Jakub Jelinek <jakub@redhat.com> PR sanitizer/114743 * asan.cc (maybe_instrument_call): Don't instrument calls to .ABNORMAL_DISPATCHER. * gcc.dg/asan/pr112709-2.c (freddy): New function from gcc.dg/ubsan/pr112709-2.c version of the test. Diff: --- gcc/asan.cc | 3 +++ gcc/testsuite/gcc.dg/asan/pr112709-2.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/asan.cc b/gcc/asan.cc index 57c3a9b00e1..9e0f51b1477 100644 --- a/gcc/asan.cc +++ b/gcc/asan.cc @@ -3030,6 +3030,9 @@ maybe_instrument_call (gimple_stmt_iterator *iter) break; } } + if (gimple_call_internal_p (stmt, IFN_ABNORMAL_DISPATCHER)) + /* Don't instrument this. */ + return false; /* If a function does not return, then we must handle clearing up the shadow stack accordingly. For ASAN we can simply set the entire stack to "valid" for accesses by setting the shadow space to 0 and all diff --git a/gcc/testsuite/gcc.dg/asan/pr112709-2.c b/gcc/testsuite/gcc.dg/asan/pr112709-2.c index e793f53507f..6fa3491c7eb 100644 --- a/gcc/testsuite/gcc.dg/asan/pr112709-2.c +++ b/gcc/testsuite/gcc.dg/asan/pr112709-2.c @@ -48,3 +48,15 @@ l3: if (x < 4) goto *q[x & 3]; } + +void +freddy (int x, int *y, struct S *p) +{ + bar (*p); + ++p; + if (x == 25) + x = foo (2); + else if (x == 42) + x = foo (foo (3)); + *y = bar (*p); +}
reply other threads:[~2024-04-17 8:24 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240417082450.77DA93858D20@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).