This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch ping (stage1-ish patches)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]