[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6aec6a77-f9b0-cf73-6bf3-4f8df8f8cd13@arm.com>
Date: Thu, 12 Nov 2020 09:55:05 +0000
From: Vincenzo Frascino <vincenzo.frascino@....com>
To: Catalin Marinas <catalin.marinas@....com>
Cc: Andrey Konovalov <andreyknvl@...gle.com>,
Will Deacon <will.deacon@....com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Marco Elver <elver@...gle.com>,
Evgenii Stepanov <eugenis@...gle.com>,
Branislav Rankov <Branislav.Rankov@....com>,
Kevin Brodsky <kevin.brodsky@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
kasan-dev@...glegroups.com, linux-arm-kernel@...ts.infradead.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9 32/44] arm64: mte: Switch GCR_EL1 in kernel entry and
exit
On 11/12/20 9:45 AM, Catalin Marinas wrote:
> On Thu, Nov 12, 2020 at 09:45:45AM +0000, Vincenzo Frascino wrote:
>> On 11/12/20 9:39 AM, Catalin Marinas wrote:
>>> On Tue, Nov 10, 2020 at 11:10:29PM +0100, Andrey Konovalov wrote:
>>>> diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
>>>> index 664c968dc43c..dbda6598c19d 100644
>>>> --- a/arch/arm64/kernel/mte.c
>>>> +++ b/arch/arm64/kernel/mte.c
>>>> @@ -129,6 +131,26 @@ void *mte_set_mem_tag_range(void *addr, size_t size, u8 tag)
>>>> return ptr;
>>>> }
>>>>
>>>> +void mte_init_tags(u64 max_tag)
>>>> +{
>>>> + static bool gcr_kernel_excl_initialized = false;
>>>> +
>>>> + if (!gcr_kernel_excl_initialized) {
>>>> + /*
>>>> + * The format of the tags in KASAN is 0xFF and in MTE is 0xF.
>>>> + * This conversion extracts an MTE tag from a KASAN tag.
>>>> + */
>>>> + u64 incl = GENMASK(FIELD_GET(MTE_TAG_MASK >> MTE_TAG_SHIFT,
>>>> + max_tag), 0);
>>>> +
>>>> + gcr_kernel_excl = ~incl & SYS_GCR_EL1_EXCL_MASK;
>>>> + gcr_kernel_excl_initialized = true;
>>>> + }
>>>> +
>>>> + /* Enable the kernel exclude mask for random tags generation. */
>>>> + write_sysreg_s(SYS_GCR_EL1_RRND | gcr_kernel_excl, SYS_GCR_EL1);
>>>> +}
>>>
>>> I don't think this function belongs to this patch. There is an earlier
>>> patch that talks about mte_init_tags() but no trace of it until this
>>> patch.
>>
>> Could you please point out to which patch are you referring to?
>
> I replied to it already (or you can search ;)). But this patch is about
> switching GCR_EL1 on exception entry/exit rather than setting up the
> initial kernel GCR_EL1 value.
>
Temporally after I asked ;) (I give you the benefit of delay of the mail server
;) ). I think that during the development the logic changed a bit, but I agree
that the comments are outdated. I am fine to move the code.
--
Regards,
Vincenzo
Powered by blists - more mailing lists