On Wed, Nov 11, 2020 at 4:22 PM Alexander Potapenko <glider@xxxxxxxxxx> wrote: > > On Tue, Nov 10, 2020 at 11:12 PM Andrey Konovalov <andreyknvl@xxxxxxxxxx> 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@xxxxxxxxxx> > > Signed-off-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx> > > Reviewed-by: Marco Elver <elver@xxxxxxxxxx> Reviewed-by: Alexander Potapenko <glider@xxxxxxxxxx> > > +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.