* [PATCH] kasan: fix mention for KASAN_HW_TAGS
@ 2023-06-19 10:12 Chanho Min
2023-06-19 10:14 ` Dmitry Vyukov
0 siblings, 1 reply; 6+ messages in thread
From: Chanho Min @ 2023-06-19 10:12 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
Dmitry Vyukov, Vincenzo Frascino
Cc: elver, kasan-dev, linux-mm, linux-kernel, gunho.lee, Chanho Min
This patch removes description of the KASAN_HW_TAGS's memory consumption.
KASAN_HW_TAGS does not set 1/32nd shadow memory.
Signed-off-by: Chanho Min <chanho.min@lge.com>
---
lib/Kconfig.kasan | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index fdca89c05745..5be1740234b9 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -124,8 +124,6 @@ config KASAN_HW_TAGS
Supported only on arm64 CPUs starting from ARMv8.5 and relies on
Memory Tagging Extension and Top Byte Ignore.
- Consumes about 1/32nd of available memory.
-
May potentially introduce problems related to pointer casting and
comparison, as it embeds a tag into the top byte of each pointer.
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kasan: fix mention for KASAN_HW_TAGS
2023-06-19 10:12 [PATCH] kasan: fix mention for KASAN_HW_TAGS Chanho Min
@ 2023-06-19 10:14 ` Dmitry Vyukov
2023-06-19 11:36 ` Marco Elver
0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Vyukov @ 2023-06-19 10:14 UTC (permalink / raw)
To: Chanho Min
Cc: Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
Vincenzo Frascino, elver, kasan-dev, linux-mm, linux-kernel,
gunho.lee
On Mon, 19 Jun 2023 at 12:12, Chanho Min <chanho.min@lge.com> wrote:
>
> This patch removes description of the KASAN_HW_TAGS's memory consumption.
> KASAN_HW_TAGS does not set 1/32nd shadow memory.
The hardware still allocates/uses shadow in MTE.
Though, it may be 1/16-th, not sure.
> Signed-off-by: Chanho Min <chanho.min@lge.com>
> ---
> lib/Kconfig.kasan | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
> index fdca89c05745..5be1740234b9 100644
> --- a/lib/Kconfig.kasan
> +++ b/lib/Kconfig.kasan
> @@ -124,8 +124,6 @@ config KASAN_HW_TAGS
> Supported only on arm64 CPUs starting from ARMv8.5 and relies on
> Memory Tagging Extension and Top Byte Ignore.
>
> - Consumes about 1/32nd of available memory.
> -
> May potentially introduce problems related to pointer casting and
> comparison, as it embeds a tag into the top byte of each pointer.
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kasan: fix mention for KASAN_HW_TAGS
2023-06-19 10:14 ` Dmitry Vyukov
@ 2023-06-19 11:36 ` Marco Elver
2023-06-20 16:32 ` Andrey Konovalov
0 siblings, 1 reply; 6+ messages in thread
From: Marco Elver @ 2023-06-19 11:36 UTC (permalink / raw)
To: Dmitry Vyukov
Cc: Chanho Min, Andrey Ryabinin, Alexander Potapenko,
Andrey Konovalov, Vincenzo Frascino, kasan-dev, linux-mm,
linux-kernel, gunho.lee
On Mon, 19 Jun 2023 at 12:15, Dmitry Vyukov <dvyukov@google.com> wrote:
> On Mon, 19 Jun 2023 at 12:12, Chanho Min <chanho.min@lge.com> wrote:
> >
> > This patch removes description of the KASAN_HW_TAGS's memory consumption.
> > KASAN_HW_TAGS does not set 1/32nd shadow memory.
>
> The hardware still allocates/uses shadow in MTE.
> Though, it may be 1/16-th, not sure.
I think the point is that it depends on the hardware implementation of
MTE. There are a range of possibilities, but enabling KASAN_HW_TAGS
doesn't consume any extra memory for tags itself if the hardware has
to enable MTE and provision tag space via firmware to begin with.
> > Signed-off-by: Chanho Min <chanho.min@lge.com>
I think you just have to be a bit clearer in the commit description,
just briefly mentioning how/where the tag space is allocated in
hardware that do support MTE. Then removing this line is probably
fair, if KASAN_HW_TAGS isn't the direct reason for tag memory being
allocated.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kasan: fix mention for KASAN_HW_TAGS
2023-06-19 11:36 ` Marco Elver
@ 2023-06-20 16:32 ` Andrey Konovalov
2023-06-23 7:58 ` [PATCH v2] " Chanho Min
0 siblings, 1 reply; 6+ messages in thread
From: Andrey Konovalov @ 2023-06-20 16:32 UTC (permalink / raw)
To: Marco Elver, Chanho Min
Cc: Dmitry Vyukov, Andrey Ryabinin, Alexander Potapenko,
Vincenzo Frascino, kasan-dev, linux-mm, linux-kernel, gunho.lee
On Mon, Jun 19, 2023 at 1:36 PM Marco Elver <elver@google.com> wrote:
>
> On Mon, 19 Jun 2023 at 12:15, Dmitry Vyukov <dvyukov@google.com> wrote:
> > On Mon, 19 Jun 2023 at 12:12, Chanho Min <chanho.min@lge.com> wrote:
> > >
> > > This patch removes description of the KASAN_HW_TAGS's memory consumption.
> > > KASAN_HW_TAGS does not set 1/32nd shadow memory.
> >
> > The hardware still allocates/uses shadow in MTE.
> > Though, it may be 1/16-th, not sure.
1/32 is correct: 4 bits for every 16 bytes.
> I think the point is that it depends on the hardware implementation of
> MTE. There are a range of possibilities, but enabling KASAN_HW_TAGS
> doesn't consume any extra memory for tags itself if the hardware has
> to enable MTE and provision tag space via firmware to begin with.
Yeah, saying that HW_TAGS consumes memory is wrong.
But it might reasonable to spell out what happens with memory in the
config options description. Something like:
"Does not consume memory by itself but relies on the 1/32nd of
available memory being reserved by the firmware when MTE is enabled."
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] kasan: fix mention for KASAN_HW_TAGS
2023-06-20 16:32 ` Andrey Konovalov
@ 2023-06-23 7:58 ` Chanho Min
2023-06-23 12:40 ` Andrey Konovalov
0 siblings, 1 reply; 6+ messages in thread
From: Chanho Min @ 2023-06-23 7:58 UTC (permalink / raw)
To: andreyknvl
Cc: chanho.min, dvyukov, elver, glider, gunho.lee, kasan-dev,
linux-kernel, linux-mm, ryabinin.a.a, vincenzo.frascino
This patch fixes description of the KASAN_HW_TAGS's memory consumption.
KASAN_HW_TAGS are dependent on the HW implementation and are not reserved
from system memory like shadow memory.
Suggested-by: Andrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: Chanho Min <chanho.min@lge.com>
---
lib/Kconfig.kasan | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index fdca89c05745..f8f9e12510b7 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -124,7 +124,8 @@ config KASAN_HW_TAGS
Supported only on arm64 CPUs starting from ARMv8.5 and relies on
Memory Tagging Extension and Top Byte Ignore.
- Consumes about 1/32nd of available memory.
+ Does not consume memory by itself but relies on the 1/32nd of
+ available memory being reserved by the firmware when MTE is enabled.
May potentially introduce problems related to pointer casting and
comparison, as it embeds a tag into the top byte of each pointer.
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] kasan: fix mention for KASAN_HW_TAGS
2023-06-23 7:58 ` [PATCH v2] " Chanho Min
@ 2023-06-23 12:40 ` Andrey Konovalov
0 siblings, 0 replies; 6+ messages in thread
From: Andrey Konovalov @ 2023-06-23 12:40 UTC (permalink / raw)
To: Chanho Min
Cc: dvyukov, elver, glider, gunho.lee, kasan-dev, linux-kernel,
linux-mm, ryabinin.a.a, vincenzo.frascino
On Fri, Jun 23, 2023 at 9:58 AM Chanho Min <chanho.min@lge.com> wrote:
>
> This patch fixes description of the KASAN_HW_TAGS's memory consumption.
> KASAN_HW_TAGS are dependent on the HW implementation and are not reserved
> from system memory like shadow memory.
>
> Suggested-by: Andrey Konovalov <andreyknvl@gmail.com>
> Signed-off-by: Chanho Min <chanho.min@lge.com>
> ---
> lib/Kconfig.kasan | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
> index fdca89c05745..f8f9e12510b7 100644
> --- a/lib/Kconfig.kasan
> +++ b/lib/Kconfig.kasan
> @@ -124,7 +124,8 @@ config KASAN_HW_TAGS
> Supported only on arm64 CPUs starting from ARMv8.5 and relies on
> Memory Tagging Extension and Top Byte Ignore.
>
> - Consumes about 1/32nd of available memory.
> + Does not consume memory by itself but relies on the 1/32nd of
> + available memory being reserved by the firmware when MTE is enabled.
>
> May potentially introduce problems related to pointer casting and
> comparison, as it embeds a tag into the top byte of each pointer.
> --
> 2.17.1
>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Thank you!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-23 12:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19 10:12 [PATCH] kasan: fix mention for KASAN_HW_TAGS Chanho Min
2023-06-19 10:14 ` Dmitry Vyukov
2023-06-19 11:36 ` Marco Elver
2023-06-20 16:32 ` Andrey Konovalov
2023-06-23 7:58 ` [PATCH v2] " Chanho Min
2023-06-23 12:40 ` Andrey Konovalov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox