public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Uecker <uecker@eecs.berkeley.edu>
To: Marek Polacek <polacek@redhat.com>
Cc: gcc Mailing List <gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>, Jeff Law <law@redhat.com>
Subject: Re: [PATCH] ubsan: improve bounds checking, add -fsanitize=bounds-strict
Date: Mon, 02 Mar 2015 17:26:00 -0000	[thread overview]
Message-ID: <20150302092618.1717a266@lemur> (raw)
In-Reply-To: <20150302163652.GA11480@redhat.com>


Marek Polacek <polacek@redhat.com>:
> On Fri, Feb 27, 2015 at 11:53:14AM -0800, Martin Uecker wrote:
> > 
> > I tested Marek's proposed change and it works correctly,
> > i.e. arrays which are not part of a struct are now
> > instrumented when accessed through a pointer. This also
> > means that the following case is diagnosed (correctly)
> > as undefined behaviour as pointed out by Richard:
> > 
> > int
> > main (void)
> > {
> >   int *t = (int *) __builtin_malloc (sizeof (int) * 9);
> >   int (*a)[3][3] = (int (*)[3][3])t;
> >   (*a)[0][9] = 1;
> > }
> > 
> > 
> > I also wanted arrays which are the last elements of a
> > struct which are not flexible-array members instrumented 
> > correctly. So I added -fsantitize=bounds-strict which does
> > this. It seems to do instrumentation similar to clang 
> > with -fsanitize=bounds.
> > 
> > Comments?
>  
> Thanks for working on it.  So I think we should split this patch in
> two; one part is a bug fix (I've opened
> <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65280>) that could go
> into gcc 5 - that is, apply my fix along with test cases covering the
> new cases, and the second part is an addition of a new option for
> strict bounds checking - I'm afraid this part has to wait for gcc 6.
> 
> I can take care of the first part and let you do the second part, which I
> could review.  Does that sound ok to you?

Thank you Marek! Sounds good to me.

Martin

      reply	other threads:[~2015-03-02 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27 20:07 Martin Uecker
2015-03-01 21:47 ` Martin Uecker
2015-03-02 16:37 ` Marek Polacek
2015-03-02 17:26   ` Martin Uecker [this message]

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=20150302092618.1717a266@lemur \
    --to=uecker@eecs.berkeley.edu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=law@redhat.com \
    --cc=polacek@redhat.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).