Re: [PATCH] lib/stackdepot.c: use a non-instrumented version of memcpy()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 16, 2018 at 6:45 PM Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
wrote:

> On 05/16/2018 06:34 PM, Alexander Potapenko wrote:
> > stackdepot used to call memcpy(), which compiler tools normally
> > instrument, therefore every lookup used to unnecessarily call
instrumented
> > code.  This is somewhat ok in the case of KASAN, but under KMSAN a lot
of
> > time was spent in the instrumentation.
> >
> > (A similar change has been previously committed for memcmp())
> >
> > Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx>
> > Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
> > Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
> > ---
> >  lib/stackdepot.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/stackdepot.c b/lib/stackdepot.c
> > index e513459a5601..d48c744fa750 100644
> > --- a/lib/stackdepot.c
> > +++ b/lib/stackdepot.c
> > @@ -140,7 +140,7 @@ static struct stack_record
*depot_alloc_stack(unsigned long *entries, int size,
> >       stack->handle.slabindex = depot_index;
> >       stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN;
> >       stack->handle.valid = 1;
> > -     memcpy(stack->entries, entries, size * sizeof(unsigned long));
> > +     __memcpy(stack->entries, entries, size * sizeof(unsigned long));

> This has no effect. Since the whole file is not instrumented memcpy
automagically replaced with __memcpy.
You're right, we just didn't have the code defining memcpy() to __memcpy()
in KMSAN. I'll fix that instead.


-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux