From: Jakub Jelinek <jakub@redhat.com>
To: Yury Gribov <y.gribov@samsung.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Andi Kleen <andi@firstfloor.org>,
Andrey Ryabinin <a.ryabinin@samsung.com>,
Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH] Optionally sanitize globals in user-defined sections
Date: Wed, 22 Apr 2015 09:00:00 -0000 [thread overview]
Message-ID: <20150422090024.GC1725@tucnak.redhat.com> (raw)
In-Reply-To: <55375F49.6010701@samsung.com>
On Wed, Apr 22, 2015 at 11:43:53AM +0300, Yury Gribov wrote:
> @@ -272,7 +273,7 @@ along with GCC; see the file COPYING3. If not see
>
> static unsigned HOST_WIDE_INT asan_shadow_offset_value;
> static bool asan_shadow_offset_computed;
> -static const char *sanitized_sections;
> +static vec<char *, va_gc> *sanitized_sections;
Why don't you use static vec<char *> sanitized_section instead?
> -set_sanitized_sections (const char *secs)
> +set_sanitized_sections (const char *sections)
> {
> - sanitized_sections = secs;
> + char *pat;
> + for (unsigned i = 0;
> + sanitized_sections && sanitized_sections->iterate (i, &pat);
> + ++i)
This really should be FOR_EACH_VEC_SAFE_ELT (if you keep using va_gc
vec *) or FOR_EACH_VEC_ELT.
> + {
> + free (pat);
> + }
No {}s around single line body.
> @@ -308,16 +325,13 @@ set_sanitized_sections (const char *secs)
> static bool
> section_sanitized_p (const char *sec)
> {
> - if (!sanitized_sections)
> - return false;
> - size_t len = strlen (sec);
> - const char *p = sanitized_sections;
> - while ((p = strstr (p, sec)))
> + char *pat;
> + for (unsigned i = 0;
> + sanitized_sections && sanitized_sections->iterate (i, &pat);
> + ++i)
Similarly. Also, wonder if won't be too expensive if people use too long
list of sections. Perhaps we could cache positive as well as negative
answers in a hash table? Though, perhaps it is worth that only if this
shows up to be a bottleneck.
Jakub
next prev parent reply other threads:[~2015-04-22 9:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 7:32 Yury Gribov
2015-04-17 7:37 ` Yury Gribov
2015-04-17 7:41 ` Jakub Jelinek
2015-04-17 17:29 ` Andi Kleen
2015-04-19 7:55 ` Yury Gribov
2015-04-19 15:48 ` Jakub Jelinek
2015-04-22 8:31 ` Yury Gribov
2015-04-22 8:43 ` Yury Gribov
2015-04-22 9:00 ` Jakub Jelinek [this message]
2015-04-22 9:26 ` Yury Gribov
2015-04-22 9:37 ` 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=20150422090024.GC1725@tucnak.redhat.com \
--to=jakub@redhat.com \
--cc=a.ryabinin@samsung.com \
--cc=andi@firstfloor.org \
--cc=dvyukov@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=y.gribov@samsung.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).