From: Jakub Jelinek <jakub@redhat.com>
To: Yuri Gribov <tetra2005@gmail.com>
Cc: "GCC Patches" <gcc-patches@gcc.gnu.org>, "Martin Liška" <mliska@suse.cz>
Subject: Re: [PATCH][PING][sanitizer/106558] asan: fix unsafe optimization of Asan checks.
Date: Mon, 21 Nov 2022 11:02:07 +0100 [thread overview]
Message-ID: <Y3tMn1pDx6QDBAIb@tucnak> (raw)
In-Reply-To: <CAJOtW+5=-WA_i7cXxrWSOVKDc_PQbtNOoaLmEQJrk3oU=uLUdw@mail.gmail.com>
On Mon, Nov 21, 2022 at 12:57:15PM +0300, Yuri Gribov wrote:
> From 4729f2db3f1b6b40ef0124e4a645788d7f66f426 Mon Sep 17 00:00:00 2001
> From: Yuri Gribov <y.gribov@samsung.com>
> Date: Sun, 14 Aug 2022 08:42:44 +0300
> Subject: [PATCH] asan: fix unsafe optimization of Asan checks.
>
> gcc/
> PR sanitizer/106558
> * sanopt.c: Do not optimize out checks for non-SSA addresses.
>
> gcc/testsuite/
> PR sanitizer/106558
> * c-c++-common/asan/pr106558.c: New test.
> ---
> gcc/sanopt.cc | 40 +++++++++++++++++-----
> gcc/testsuite/c-c++-common/asan/pr106558.c | 23 +++++++++++++
> 2 files changed, 54 insertions(+), 9 deletions(-)
> create mode 100644 gcc/testsuite/c-c++-common/asan/pr106558.c
>
> diff --git a/gcc/sanopt.cc b/gcc/sanopt.cc
> index e9d188d7889..13942a0b1da 100644
> --- a/gcc/sanopt.cc
> +++ b/gcc/sanopt.cc
> @@ -80,16 +80,16 @@ struct sanopt_info
>
> /* If T has a single definition of form T = T2, return T2. */
>
> -static tree
> +static gimple *
> maybe_get_single_definition (tree t)
> {
> if (TREE_CODE (t) == SSA_NAME)
> {
> gimple *g = SSA_NAME_DEF_STMT (t);
> if (gimple_assign_single_p (g))
> - return gimple_assign_rhs1 (g);
> + return g;
> }
> - return NULL_TREE;
> + return NULL;
> }
>
> /* Tree triplet for vptr_check_map. */
> @@ -618,11 +618,30 @@ maybe_optimize_ubsan_vptr_ifn (class sanopt_ctx *ctx, gimple *stmt)
> return true;
> }
>
> +/* Checks whether value of T in CHECK and USE is the same. */
> +
> +static bool same_value_p (gimple *check, gimple *use, tree t)
Formatting. Function name should be on another line:
static bool
same_value_p (gimple *check, gimple *use, tree t)
Otherwise LGTM. Thanks and sorry for the review delay.
Jakub
next prev parent reply other threads:[~2022-11-21 10:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 12:14 [PATCH][sanitizer/106558] " Yuri Gribov
2022-11-21 9:57 ` [PATCH][PING][sanitizer/106558] " Yuri Gribov
2022-11-21 10:02 ` Jakub Jelinek [this message]
2022-11-25 16:18 ` Martin Liška
2022-11-28 9:50 ` Martin Liška
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=Y3tMn1pDx6QDBAIb@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
--cc=tetra2005@gmail.com \
/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).