From: Jakub Jelinek <jakub@redhat.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] ASAN: handle addressable params (PR sanitize/81040).
Date: Fri, 30 Jun 2017 09:31:00 -0000 [thread overview]
Message-ID: <20170630093059.GG2123@tucnak> (raw)
In-Reply-To: <53a86396-fb7f-40c0-bd6a-334c377febf5@suse.cz>
On Fri, Jun 30, 2017 at 11:21:48AM +0200, Martin Liška wrote:
> @@ -858,6 +864,132 @@ sanitize_asan_mark_poison (void)
> }
> }
>
> +/* Rewrite all usages of tree OP which is a PARM_DECL with a VAR_DECL
> + that is it's DECL_VALUE_EXPR. */
> +
> +static tree
> +rewrite_usage_of_param (tree *op, int *walk_subtrees, void *)
> +{
> + if (TREE_CODE (*op) == PARM_DECL && DECL_HAS_VALUE_EXPR_P (*op))
> + {
> + *op = DECL_VALUE_EXPR (*op);
> + *walk_subtrees = 0;
> + }
If you are going to rely just on DECL_HAS_VALUE_EXPR_P here
> + for (tree arg = DECL_ARGUMENTS (current_function_decl);
> + arg; arg = DECL_CHAIN (arg))
> + {
I think you should gcc_assert here that !DECL_HAS_VALUE_EXPR_P (arg) here.
If that ever fails, another possibility would be to temporarily clear those
flags and remember it and then set it again after the walk_*. The question
would be what to do with arguments that already have DECL_VALUE_EXPR, are
addressable and you want to rewrite them.
> + if (TREE_ADDRESSABLE (arg) && !TREE_ADDRESSABLE (TREE_TYPE (arg)))
> + {
> + TREE_ADDRESSABLE (arg) = 0;
> + /* The parameter is no longer addressable. */
> + tree type = TREE_TYPE (arg);
> + has_any_addressable_param = true;
Otherwise LGTM.
Jakub
next prev parent reply other threads:[~2017-06-30 9:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 13:50 Martin Liška
2017-06-19 14:13 ` Jakub Jelinek
2017-06-20 9:23 ` Martin Liška
2017-06-20 9:32 ` Jakub Jelinek
2017-06-20 13:07 ` Martin Liška
2017-06-28 13:16 ` Martin Liška
2017-06-29 11:17 ` Jakub Jelinek
2017-06-30 9:21 ` Martin Liška
2017-06-30 9:31 ` Jakub Jelinek [this message]
2017-07-04 7:47 ` [PATCH] Enable addressable params sanitization with --param asan-stack=1 Martin Liška
2017-07-04 8:00 ` Jakub Jelinek
2017-07-04 10:52 ` Martin Liška
2017-07-04 8:49 ` [PATCH] ASAN: handle addressable params (PR sanitize/81040) Jakub Jelinek
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=20170630093059.GG2123@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/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).