[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+fCnZe49OGG_8J40_d9dTUBktY6qe-1dq1Y6Q+7hY9=xmUWQw@mail.gmail.com>
Date: Wed, 23 Oct 2024 20:42:03 +0200
From: Andrey Konovalov <andreyknvl@...il.com>
To: Samuel Holland <samuel.holland@...ive.com>
Cc: Palmer Dabbelt <palmer@...belt.com>, linux-riscv@...ts.infradead.org,
Andrey Ryabinin <ryabinin.a.a@...il.com>, Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>, Vincenzo Frascino <vincenzo.frascino@....com>,
kasan-dev@...glegroups.com, llvm@...ts.linux.dev,
Catalin Marinas <catalin.marinas@....com>, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Alexandre Ghiti <alexghiti@...osinc.com>, Will Deacon <will@...nel.org>,
Evgenii Stepanov <eugenis@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 3/9] kasan: sw_tags: Support outline stack tag generation
On Tue, Oct 22, 2024 at 3:59 AM Samuel Holland
<samuel.holland@...ive.com> wrote:
>
> This allows stack tagging to be disabled at runtime by tagging all
> stack objects with the match-all tag. This is necessary on RISC-V,
> where a kernel with KASAN_SW_TAGS enabled is expected to boot on
> hardware without pointer masking support.
>
> Signed-off-by: Samuel Holland <samuel.holland@...ive.com>
> ---
>
> Changes in v2:
> - Split the generic and RISC-V parts of stack tag generation control
> to avoid breaking bisectability
>
> mm/kasan/kasan.h | 2 ++
> mm/kasan/sw_tags.c | 9 +++++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index f438a6cdc964..72da5ddcceaa 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -636,6 +636,8 @@ void *__asan_memset(void *addr, int c, ssize_t len);
> void *__asan_memmove(void *dest, const void *src, ssize_t len);
> void *__asan_memcpy(void *dest, const void *src, ssize_t len);
>
> +u8 __hwasan_generate_tag(void);
> +
> void __hwasan_load1_noabort(void *);
> void __hwasan_store1_noabort(void *);
> void __hwasan_load2_noabort(void *);
> diff --git a/mm/kasan/sw_tags.c b/mm/kasan/sw_tags.c
> index 220b5d4c6876..32435d33583a 100644
> --- a/mm/kasan/sw_tags.c
> +++ b/mm/kasan/sw_tags.c
> @@ -70,6 +70,15 @@ u8 kasan_random_tag(void)
> return (u8)(state % (KASAN_TAG_MAX + 1));
> }
>
> +u8 __hwasan_generate_tag(void)
> +{
> + if (!kasan_enabled())
> + return KASAN_TAG_KERNEL;
> +
> + return kasan_random_tag();
> +}
> +EXPORT_SYMBOL(__hwasan_generate_tag);
> +
> bool kasan_check_range(const void *addr, size_t size, bool write,
> unsigned long ret_ip)
> {
> --
> 2.45.1
>
Reviewed-by: Andrey Konovalov <andreyknvl@...il.com>
Powered by blists - more mailing lists