On Tue, Oct 23, 2012 at 8:58 AM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Tue, Oct 23, 2012 at 08:47:48AM -0700, Xinliang David Li wrote:
>> > +      /* The builtin below cannot be safely instrumented as their
>> > +         length parameter is just a mere limit.
>> > +
>>
>> Why can't the following be instrumented? The length is min (n, strlen (str)).
>
> Because that would be too expensive, and libasan intercepts (most of the)
> str* functions anyway, both so that it can check this and test argument
> overlap.  The memory builtin instrumentation is done primary for the cases
> where the builtins are expanded inline, without calling library routine,
> because then nothing is verified in libasan.
>

Ok that makes sense.

thanks,

David


>> For 'strlen', can the memory check be done at the end of the string
>> using the returned length?
>
> Guess strlen is commonly expanded inline, so it would be worthwhile to check
> the shadow memory after the call (well, we could check the first byte
> before the call and the last one after the call).
>
>         Jakub

Reply via email to