mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
![Andrey Konovalov](/assets/img/avatar_default.png)
Move the addr_has_metadata() check into kasan_find_first_bad_addr(). Link: https://lkml.kernel.org/r/a49576f7a23283d786ba61579cb0c5057e8f0b9b.1646237226.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Marco Elver <elver@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
38 lines
902 B
C
38 lines
902 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* This file contains hardware tag-based KASAN specific error reporting code.
|
|
*
|
|
* Copyright (c) 2020 Google, Inc.
|
|
* Author: Andrey Konovalov <andreyknvl@google.com>
|
|
*/
|
|
|
|
#include <linux/kasan.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/memory.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/string.h>
|
|
#include <linux/types.h>
|
|
|
|
#include "kasan.h"
|
|
|
|
void *kasan_find_first_bad_addr(void *addr, size_t size)
|
|
{
|
|
/* Return the same value regardless of whether addr_has_metadata(). */
|
|
return kasan_reset_tag(addr);
|
|
}
|
|
|
|
void kasan_metadata_fetch_row(char *buffer, void *row)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < META_BYTES_PER_ROW; i++)
|
|
buffer[i] = hw_get_mem_tag(row + i * KASAN_GRANULE_SIZE);
|
|
}
|
|
|
|
void kasan_print_tags(u8 addr_tag, const void *addr)
|
|
{
|
|
u8 memory_tag = hw_get_mem_tag((void *)addr);
|
|
|
|
pr_err("Pointer tag: [%02x], memory tag: [%02x]\n",
|
|
addr_tag, memory_tag);
|
|
}
|