[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210118102426.GA29688@C02TD0UTHF1T.local>
Date: Mon, 18 Jan 2021 10:24:26 +0000
From: Mark Rutland <mark.rutland@....com>
To: Vincenzo Frascino <vincenzo.frascino@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kasan-dev@...glegroups.com, Marco Elver <elver@...gle.com>,
Catalin Marinas <catalin.marinas@....com>,
Branislav Rankov <Branislav.Rankov@....com>,
Alexander Potapenko <glider@...gle.com>,
Evgenii Stepanov <eugenis@...gle.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Will Deacon <will@...nel.org>,
Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [PATCH v3 1/4] kasan, arm64: Add KASAN light mode
On Sat, Jan 16, 2021 at 01:47:08PM +0000, Vincenzo Frascino wrote:
> On 1/15/21 3:08 PM, Mark Rutland wrote:
> > On Fri, Jan 15, 2021 at 12:00:40PM +0000, Vincenzo Frascino wrote:
> >> #ifdef CONFIG_KASAN_HW_TAGS
> >> -#define arch_enable_tagging() mte_enable_kernel()
> >> +#define arch_enable_tagging(mode) mte_enable_kernel(mode)
> >
> > Rather than passing a mode in, I think it'd be better to have:
> >
> > * arch_enable_tagging_prod()
> > * arch_enable_tagging_light()
> >
> > ... that we can map in the arch code to separate:
> >
> > * mte_enable_kernel_sync()
> > * mte_enable_kernel_async()
> >
> > ... as by construction that avoids calls with an unhandled mode, and we
> > wouldn't need the mode enum kasan_hw_tags_mode...
> >
> >> +static inline int hw_init_mode(enum kasan_arg_mode mode)
> >> +{
> >> + switch (mode) {
> >> + case KASAN_ARG_MODE_LIGHT:
> >> + return KASAN_HW_TAGS_ASYNC;
> >> + default:
> >> + return KASAN_HW_TAGS_SYNC;
> >> + }
> >> +}
> >
> > ... and we can just have a wrapper like this to call either of the two functions directly, i.e.
> >
> > static inline void hw_enable_tagging_mode(enum kasan_arg_mode mode)
> > {
> > if (mode == KASAN_ARG_MODE_LIGHT)
> > arch_enable_tagging_mode_light();
> > else
> > arch_enable_tagging_mode_prod();
> > }
> >
>
> Fine by me, this would remove the need of adding a new enumeration as well and
> reflect on the arch code. I would keep "arch_enable_tagging_mode_sync" and
> "arch_enable_tagging_mode_async" though to give a clear indication in the KASAN
> code of the mode we are setting. I will adapt my code accordingly for v4.
Thanks, that sounds great!
I completely agree on keeping the '_sync' and '_aync' suffixes in the
the core code.
Mark.
Powered by blists - more mailing lists