[PATCH v9 23/44] kasan: separate metadata_fetch_row for each mode

Alexander Potapenko glider at google.com
Wed Nov 11 11:19:28 EST 2020


On Wed, Nov 11, 2020 at 4:22 PM Alexander Potapenko <glider at google.com> wrote:
>
> On Tue, Nov 10, 2020 at 11:12 PM Andrey Konovalov <andreyknvl at google.com> wrote:
> >
> > This is a preparatory commit for the upcoming addition of a new hardware
> > tag-based (MTE-based) KASAN mode.
> >
> > Rework print_memory_metadata() to make it agnostic with regard to the
> > way metadata is stored. Allow providing a separate metadata_fetch_row()
> > implementation for each KASAN mode. Hardware tag-based KASAN will provide
> > its own implementation that doesn't use shadow memory.
> >
> > No functional changes for software modes.
> >
> > Signed-off-by: Andrey Konovalov <andreyknvl at google.com>
> > Signed-off-by: Vincenzo Frascino <vincenzo.frascino at arm.com>
> > Reviewed-by: Marco Elver <elver at google.com>
Reviewed-by: Alexander Potapenko <glider at google.com>

> > +void metadata_fetch_row(char *buffer, void *row)
> > +{
> > +       memcpy(buffer, kasan_mem_to_shadow(row), META_BYTES_PER_ROW);
>
> I think it is important to use __memcpy() instead of memcpy() in KASAN
> runtime to avoid calling instrumented code.

Please disregard this. Turns out we define memcpy to __memcpy for
non-instrumented files.



More information about the linux-arm-kernel mailing list