This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch ping (stage1-ish patches)
- From: Jeff Law <law at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Richard Biener <rguenther at suse dot de>, Dodji Seketeli <dseketel at redhat dot com>, Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Nov 2013 13:06:06 -0700
- Subject: Re: Patch ping (stage1-ish patches)
- Authentication-results: sourceware.org; auth=none
- References: <20131121170912 dot GG3403 at virgil dot suse> <528F73E2 dot 9060805 at redhat dot com> <20131122151519 dot GD892 at tucnak dot redhat dot com> <528F8802 dot 3050408 at redhat dot com> <20131127073647 dot GW892 at tucnak dot redhat dot com>
On 11/27/13 00:36, Jakub Jelinek wrote:
AddressSanitizer use-after-return instrumentation:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02070.html
+ HOST_WIDE_INT offset, sz;
+ sz = ASAN_RED_ZONE_SIZE;
+ sz = data.asan_vec[0] - prev_offset;
Seems to me like the first assignment to sz is dead. Clearly something
isn't right here.
In fact, the whole fragment seems a bit wonky in that you set sz prior
to the conditional, use it in the conditional, then set it in both arms.
I'm guessing that structure is to simplify the conditional, which is
fine. In fact, I would hazard a guess the dead assignment is a result
of trying to clean things up in the conditional.
+ HOST_WIDE_INT offset, sz;
+ sz = ASAN_RED_ZONE_SIZE;
+ sz = data.asan_vec[0] - prev_offset;
+ if (data.asan_alignb > ASAN_RED_ZONE_SIZE
+ && data.asan_alignb <= 4096
+ && sz + ASAN_RED_ZONE_SIZE >= data.asan_alignb)
+ {
+ sz = ((sz + ASAN_RED_ZONE_SIZE + data.asan_alignb - 1)
+ & ~(data.asan_alignb - HOST_WIDE_INT_1)) - sz;
+ }
+ else
+ sz = ASAN_RED_ZONE_SIZE;
+ offset
+ = alloc_stack_frame_space (sz, ASAN_RED_ZONE_SIZE);
I'm assuming that the code you're generating to interface with the ubsan
libraries is sane -- I don't know those APIs at all. I trust that if
there's an issue you'll address is appropriately.
With the fragment above fixed, this is OK.
jeff