linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com,
	Andrew Morton <akpm@linux-foundation.org>,
	Will Deacon <will@kernel.org>, Dmitry Vyukov <dvyukov@google.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Alexander Potapenko <glider@google.com>,
	Marco Elver <elver@google.com>,
	Evgenii Stepanov <eugenis@google.com>,
	Branislav Rankov <Branislav.Rankov@arm.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Subject: Re: [PATCH v15 5/8] arm64: mte: Enable TCO in functions that can read beyond buffer limits
Date: Fri, 12 Mar 2021 15:29:28 +0000	[thread overview]
Message-ID: <20210312152927.GD24210@arm.com> (raw)
In-Reply-To: <31b7a388-4c57-cb25-2d30-da7c37e2b4d6@arm.com>

On Fri, Mar 12, 2021 at 03:23:44PM +0000, Vincenzo Frascino wrote:
> On 3/12/21 3:13 PM, Catalin Marinas wrote:
> > On Fri, Mar 12, 2021 at 02:22:07PM +0000, Vincenzo Frascino wrote:
> >> diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h
> >> index 9b557a457f24..8603c6636a7d 100644
> >> --- a/arch/arm64/include/asm/mte.h
> >> +++ b/arch/arm64/include/asm/mte.h
> >> @@ -90,5 +90,20 @@ static inline void mte_assign_mem_tag_range(void *addr, size_t size)
> >>  
> >>  #endif /* CONFIG_ARM64_MTE */
> >>  
> >> +#ifdef CONFIG_KASAN_HW_TAGS
> >> +/* Whether the MTE asynchronous mode is enabled. */
> >> +DECLARE_STATIC_KEY_FALSE(mte_async_mode);
> >> +
> >> +static inline bool system_uses_mte_async_mode(void)
> >> +{
> >> +	return static_branch_unlikely(&mte_async_mode);
> >> +}
> >> +#else
> >> +static inline bool system_uses_mte_async_mode(void)
> >> +{
> >> +	return false;
> >> +}
> >> +#endif /* CONFIG_KASAN_HW_TAGS */
> > 
> > You can write this with fewer lines:
> > 
> > DECLARE_STATIC_KEY_FALSE(mte_async_mode);
> > 
> > static inline bool system_uses_mte_async_mode(void)
> > {
> > 	return IS_ENABLED(CONFIG_KASAN_HW_TAGS) &&
> > 		static_branch_unlikely(&mte_async_mode);
> > }
> > 
> > The compiler will ensure that mte_async_mode is not referred when
> > !CONFIG_KASAN_HW_TAGS and therefore doesn't need to be defined.
> 
> Yes, I agree, but I introduce "#ifdef CONFIG_KASAN_HW_TAGS" in the successive
> patch anyway, according to me the overall code looks more uniform like this. But
> I do not have a strong opinion or preference on this.

Ah, yes, I didn't look at patch 6 again as it was already reviewed and I
forgot the context. Leave it as it is then, my reviewed-by still stands.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-03-12 15:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 14:22 [PATCH v15 0/8] arm64: ARMv8.5-A: MTE: Add async mode support Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 1/8] arm64: mte: Add asynchronous " Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 2/8] kasan: Add KASAN mode kernel parameter Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 3/8] arm64: mte: Drop arch_enable_tagging() Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 4/8] kasan: Add report for async mode Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 5/8] arm64: mte: Enable TCO in functions that can read beyond buffer limits Vincenzo Frascino
2021-03-12 15:13   ` Catalin Marinas
2021-03-12 15:23     ` Vincenzo Frascino
2021-03-12 15:29       ` Catalin Marinas [this message]
2021-03-12 15:44         ` Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 6/8] arm64: mte: Enable async tag check fault Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 7/8] arm64: mte: Report async tag faults before suspend Vincenzo Frascino
2021-03-12 14:22 ` [PATCH v15 8/8] kasan, arm64: tests supports for HW_TAGS async mode Vincenzo Frascino
2021-03-12 14:49   ` Andrey Konovalov
2021-03-12 14:56     ` Vincenzo Frascino
2021-03-12 14:50 ` [PATCH v15 0/8] arm64: ARMv8.5-A: MTE: Add async mode support Andrey Konovalov
2021-03-12 14:56   ` Vincenzo Frascino
2021-03-12 15:14 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210312152927.GD24210@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Branislav.Rankov@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=eugenis@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).