Re: [PATCH] Implement -fsanitize=object-size

2014-10-14 Thread Jakub Jelinek
On Fri, Oct 10, 2014 at 12:26:44PM +0200, Jakub Jelinek wrote: > 2014-10-10 Jakub Jelinek > > * ubsan/Makefile.am (DEFS): Add -DPIC. > * ubsan/Makefile.in: Regenerated. I've now bootstrapped/regtested this on x86_64-linux and i686-linux and committed as obvious. 2014-10-14 Jakub

Re: [PATCH] Implement -fsanitize=object-size

2014-10-10 Thread Marek Polacek
On Fri, Oct 10, 2014 at 12:26:44PM +0200, Jakub Jelinek wrote: > On Fri, Oct 10, 2014 at 12:04:08PM +0200, Marek Polacek wrote: > > I couldn't test bootstrap-ubsan, because of error: > > /home/polacek/x/trunk/prev-x86_64-unknown-linux-gnu/libsanitizer/ubsan/.libs/libubsan.a(ubsan_init.o): > > .prei

Re: [PATCH] Implement -fsanitize=object-size

2014-10-10 Thread Jakub Jelinek
On Fri, Oct 10, 2014 at 12:04:08PM +0200, Marek Polacek wrote: > I couldn't test bootstrap-ubsan, because of error: > /home/polacek/x/trunk/prev-x86_64-unknown-linux-gnu/libsanitizer/ubsan/.libs/libubsan.a(ubsan_init.o): > .preinit_array section is not allowed in DSO > but I remember that the previ

Re: [PATCH] Implement -fsanitize=object-size

2014-10-10 Thread Marek Polacek
On Thu, Oct 02, 2014 at 02:04:24PM +0200, Jakub Jelinek wrote: > Looks much better. Cool. > There are some nits I'd change, like: > 1) no need not to handle bitfields > 2) IMHO it should handle PARM_DECL and RESULT_DECL alongside of VAR_DECL > 3) decl_p IMHO should use just DECL_P > 4) it doesn't

Re: [PATCH] Implement -fsanitize=object-size

2014-10-02 Thread Jakub Jelinek
On Thu, Sep 11, 2014 at 07:47:51PM +0200, Marek Polacek wrote: > So, how does this look now? Looks much better. There are some nits I'd change, like: 1) no need not to handle bitfields 2) IMHO it should handle PARM_DECL and RESULT_DECL alongside of VAR_DECL 3) decl_p IMHO should use just DECL_P 4

Re: [PATCH] Implement -fsanitize=object-size

2014-09-11 Thread Marek Polacek
Sorry I let this slide. On Mon, Jul 14, 2014 at 01:54:13PM +0200, Jakub Jelinek wrote: > On Sun, Jul 13, 2014 at 07:55:44PM +0200, Marek Polacek wrote: > > 2014-07-13 Marek Polacek > > > > * ubsan.h (struct ubsan_mismatch_data): > > Missing description. Fixed. > > + gcc_assert (TREE_C

Re: [PATCH] Implement -fsanitize=object-size

2014-07-14 Thread Jakub Jelinek
On Sun, Jul 13, 2014 at 07:55:44PM +0200, Marek Polacek wrote: > 2014-07-13 Marek Polacek > > * ubsan.h (struct ubsan_mismatch_data): Missing description. > +/* Expand UBSAN_OBJECT_SIZE internal call. */ > + > +void > +ubsan_expand_objsize_ifn (gimple_stmt_iterator *gsi) > +{ > + gim

Re: [PATCH] Implement -fsanitize=object-size

2014-07-13 Thread Gerald Pfeifer
Hi Marek, On Sun, 13 Jul 2014, Marek Polacek wrote: > --- gcc/doc/invoke.texi > +++ gcc/doc/invoke.texi > @@ -5477,6 +5477,12 @@ This option enables instrumentation of array bounds. > Various out of bounds > accesses are detected. Flexible array members and initializers of variables > with st

[PATCH] Implement -fsanitize=object-size

2014-07-13 Thread Marek Polacek
The following is an attempt to implement -fsanitize=object-size. When it sees a MEM_REF, it goes through the definition statements and stops on sth like ptr = &sth. Then it tries to determine the object size using __builtin_object_size and generates an internal call (in .ubsan pass). The .sanopt