2020-11-10 22:22:42

by Andrey Konovalov

[permalink] [raw]
Subject: [PATCH v2 05/20] kasan: allow VMAP_STACK for HW_TAGS mode

Even though hardware tag-based mode currently doesn't support checking
vmalloc allocations, it doesn't use shadow memory and works with
VMAP_STACK as is. Change VMAP_STACK definition accordingly.

Signed-off-by: Andrey Konovalov <[email protected]>
Link: https://linux-review.googlesource.com/id/I3552cbc12321dec82cd7372676e9372a2eb452ac
---
arch/Kconfig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 56b6ccc0e32d..7e7d14fae568 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -914,16 +914,16 @@ config VMAP_STACK
default y
bool "Use a virtually-mapped stack"
depends on HAVE_ARCH_VMAP_STACK
- depends on !KASAN || KASAN_VMALLOC
+ depends on !KASAN || KASAN_HW_TAGS || KASAN_VMALLOC
help
Enable this if you want the use virtually-mapped kernel stacks
with guard pages. This causes kernel stack overflows to be
caught immediately rather than causing difficult-to-diagnose
corruption.

- To use this with KASAN, the architecture must support backing
- virtual mappings with real shadow memory, and KASAN_VMALLOC must
- be enabled.
+ To use this with software KASAN modes, the architecture must support
+ backing virtual mappings with real shadow memory, and KASAN_VMALLOC
+ must be enabled.

config ARCH_OPTIONAL_KERNEL_RWX
def_bool n
--
2.29.2.222.g5d2a92d10f8-goog


2020-11-11 16:22:55

by Marco Elver

[permalink] [raw]
Subject: Re: [PATCH v2 05/20] kasan: allow VMAP_STACK for HW_TAGS mode

On Tue, Nov 10, 2020 at 11:20PM +0100, Andrey Konovalov wrote:
> Even though hardware tag-based mode currently doesn't support checking
> vmalloc allocations, it doesn't use shadow memory and works with
> VMAP_STACK as is. Change VMAP_STACK definition accordingly.
>
> Signed-off-by: Andrey Konovalov <[email protected]>
> Link: https://linux-review.googlesource.com/id/I3552cbc12321dec82cd7372676e9372a2eb452ac
> ---

Shouldn't this be in the other series?

FWIW,

Reviewed-by: Marco Elver <[email protected]>

> arch/Kconfig | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 56b6ccc0e32d..7e7d14fae568 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -914,16 +914,16 @@ config VMAP_STACK
> default y
> bool "Use a virtually-mapped stack"
> depends on HAVE_ARCH_VMAP_STACK
> - depends on !KASAN || KASAN_VMALLOC
> + depends on !KASAN || KASAN_HW_TAGS || KASAN_VMALLOC
> help
> Enable this if you want the use virtually-mapped kernel stacks
> with guard pages. This causes kernel stack overflows to be
> caught immediately rather than causing difficult-to-diagnose
> corruption.
>
> - To use this with KASAN, the architecture must support backing
> - virtual mappings with real shadow memory, and KASAN_VMALLOC must
> - be enabled.
> + To use this with software KASAN modes, the architecture must support
> + backing virtual mappings with real shadow memory, and KASAN_VMALLOC
> + must be enabled.
>
> config ARCH_OPTIONAL_KERNEL_RWX
> def_bool n
> --
> 2.29.2.222.g5d2a92d10f8-goog
>

2020-11-12 01:40:24

by Andrey Konovalov

[permalink] [raw]
Subject: Re: [PATCH v2 05/20] kasan: allow VMAP_STACK for HW_TAGS mode

On Wed, Nov 11, 2020 at 5:20 PM Marco Elver <[email protected]> wrote:
>
> On Tue, Nov 10, 2020 at 11:20PM +0100, Andrey Konovalov wrote:
> > Even though hardware tag-based mode currently doesn't support checking
> > vmalloc allocations, it doesn't use shadow memory and works with
> > VMAP_STACK as is. Change VMAP_STACK definition accordingly.
> >
> > Signed-off-by: Andrey Konovalov <[email protected]>
> > Link: https://linux-review.googlesource.com/id/I3552cbc12321dec82cd7372676e9372a2eb452ac
> > ---
>
> Shouldn't this be in the other series?

I don't think it makes much difference considering the series will go
in together.

>
> FWIW,
>
> Reviewed-by: Marco Elver <[email protected]>

Thanks!

>
> > arch/Kconfig | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/Kconfig b/arch/Kconfig
> > index 56b6ccc0e32d..7e7d14fae568 100644
> > --- a/arch/Kconfig
> > +++ b/arch/Kconfig
> > @@ -914,16 +914,16 @@ config VMAP_STACK
> > default y
> > bool "Use a virtually-mapped stack"
> > depends on HAVE_ARCH_VMAP_STACK
> > - depends on !KASAN || KASAN_VMALLOC
> > + depends on !KASAN || KASAN_HW_TAGS || KASAN_VMALLOC
> > help
> > Enable this if you want the use virtually-mapped kernel stacks
> > with guard pages. This causes kernel stack overflows to be
> > caught immediately rather than causing difficult-to-diagnose
> > corruption.
> >
> > - To use this with KASAN, the architecture must support backing
> > - virtual mappings with real shadow memory, and KASAN_VMALLOC must
> > - be enabled.
> > + To use this with software KASAN modes, the architecture must support
> > + backing virtual mappings with real shadow memory, and KASAN_VMALLOC
> > + must be enabled.
> >
> > config ARCH_OPTIONAL_KERNEL_RWX
> > def_bool n
> > --
> > 2.29.2.222.g5d2a92d10f8-goog
> >

2020-11-12 10:34:58

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH v2 05/20] kasan: allow VMAP_STACK for HW_TAGS mode

On Tue, Nov 10, 2020 at 11:20:09PM +0100, Andrey Konovalov wrote:
> Even though hardware tag-based mode currently doesn't support checking
> vmalloc allocations, it doesn't use shadow memory and works with
> VMAP_STACK as is. Change VMAP_STACK definition accordingly.
>
> Signed-off-by: Andrey Konovalov <[email protected]>
> Link: https://linux-review.googlesource.com/id/I3552cbc12321dec82cd7372676e9372a2eb452ac
> ---
> arch/Kconfig | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 56b6ccc0e32d..7e7d14fae568 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -914,16 +914,16 @@ config VMAP_STACK
> default y
> bool "Use a virtually-mapped stack"
> depends on HAVE_ARCH_VMAP_STACK
> - depends on !KASAN || KASAN_VMALLOC
> + depends on !KASAN || KASAN_HW_TAGS || KASAN_VMALLOC

From the arm64 perspective:

Acked-by: Catalin Marinas <[email protected]>