[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAeHK+wzgy8UFBMzRFKUchSekURm3rkaJsOLe=VSE9D-6BAtvg@mail.gmail.com>
Date: Fri, 22 Jan 2021 17:09:43 +0100
From: Andrey Konovalov <andreyknvl@...gle.com>
To: Vincenzo Frascino <vincenzo.frascino@....com>
Cc: Linux ARM <linux-arm-kernel@...ts.infradead.org>,
LKML <linux-kernel@...r.kernel.org>,
kasan-dev <kasan-dev@...glegroups.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Leon Romanovsky <leonro@...lanox.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>,
"Paul E . McKenney" <paulmck@...nel.org>,
Naresh Kamboju <naresh.kamboju@...aro.org>
Subject: Re: [PATCH v4 3/3] kasan: Make addr_has_metadata() return true for
valid addresses
On Fri, Jan 22, 2021 at 4:57 PM Vincenzo Frascino
<vincenzo.frascino@....com> wrote:
>
> Currently, addr_has_metadata() returns true for every address.
> An invalid address (e.g. NULL) passed to the function when,
> KASAN_HW_TAGS is enabled, leads to a kernel panic.
>
> Make addr_has_metadata() return true for valid addresses only.
>
> Note: KASAN_HW_TAGS support for vmalloc will be added with a future
> patch.
>
> Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>
> Cc: Alexander Potapenko <glider@...gle.com>
> Cc: Dmitry Vyukov <dvyukov@...gle.com>
> Cc: Leon Romanovsky <leonro@...lanox.com>
> Cc: Andrey Konovalov <andreyknvl@...gle.com>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@....com>
> ---
> mm/kasan/kasan.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index cc4d9e1d49b1..8c706e7652f2 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -209,7 +209,7 @@ bool check_memory_region(unsigned long addr, size_t size, bool write,
>
> static inline bool addr_has_metadata(const void *addr)
> {
> - return true;
> + return (is_vmalloc_addr(addr) || virt_addr_valid(addr));
> }
>
> #endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
> --
> 2.30.0
>
Reviewed-by: Andrey Konovalov <andreyknvl@...gle.com>
Thanks!
Powered by blists - more mailing lists