KASAN core changes for ppc64 radix KASAN
Subsystems (3)
v13 cover KASAN core changes for ppc64 radix KASAN
Building on the work of Christophe, Aneesh and Balbir, I've ported KASAN to 64-bit Book3S kernels running on the Radix MMU. I've been trying this for a while, but we keep having collisions between the kasan code in the mm tree and the code I want to put in to the ppc tree.
So this series just contains the kasan core changes that we need. These can go in via the mm tree. I will then propose the powerpc changes for a later cycle. (The most recent RFC for the powerpc changes is in the last series at
https://lore.kernel.org/linux-mm/[email protected]/
)
v13 applies to next-20210611. There should be no noticeable changes to other platforms.
Changes since v12: respond to Marco's review comments - clean up the help for ARCH_DISABLE_KASAN_INLINE, and add an arch readiness check to the new granule poisioning function. Thanks Marco.
Kind regards,
Daniel
Daniel Axtens (3):
kasan: allow an architecture to disable inline instrumentation
kasan: allow architectures to provide an outline readiness check
kasan: define and use MAX_PTRS_PER_* for early shadow tables
include/linux/kasan.h | 18 +++++++++++++++--- lib/Kconfig.kasan | 14 ++++++++++++++ mm/kasan/common.c | 4 ++++ mm/kasan/generic.c | 3 +++ mm/kasan/init.c | 6 +++--- mm/kasan/kasan.h | 4 ++++ mm/kasan/shadow.c | 8 ++++++++ 7 files changed, 51 insertions(+), 6 deletions(-)
Signature · 1 line
2.30.2
PATCH v13 1/3 kasan: allow an architecture to disable inline instrumentation
For annoying architectural reasons, it's very difficult to support inline instrumentation on powerpc64.*
Add a Kconfig flag to allow an arch to disable inline. (It's a bit annoying to be 'backwards', but I'm not aware of any way to have an arch force a symbol to be 'n', rather than 'y'.)
We also disable stack instrumentation in this case as it does things that are functionally equivalent to inline instrumentation, namely adding code that touches the shadow directly without going through a C helper.
* on ppc64 atm, the shadow lives in virtual memory and isn't accessible in real mode. However, before we turn on virtual memory, we parse the device tree to determine which platform and MMU we're running under. That calls generic DT code, which is instrumented. Inline instrumentation in DT would unconditionally attempt to touch the shadow region, which we won't have set up yet, and would crash. We can make outline mode wait for the arch to be ready, but we can't change what the compiler inserts for inline mode.
--- lib/Kconfig.kasan | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
lib/Kconfig.kasan +14 -0
@@ -12,6 +12,15 @@ config HAVE_ARCH_KASAN_HW_TAGS config HAVE_ARCH_KASAN_VMALLOC bool +config ARCH_DISABLE_KASAN_INLINE + bool + help + Sometimes an architecture might not be able to support inline + instrumentation but might be able to support outline instrumentation. + This option allows an architecture to prevent inline and stack + instrumentation from being enabled. + + config CC_HAS_KASAN_GENERIC def_bool $(cc-option, -fsanitize=kernel-address)
@@ -130,6 +139,7 @@ config KASAN_OUTLINE config KASAN_INLINE bool "Inline instrumentation" + depends on !ARCH_DISABLE_KASAN_INLINE help Compiler directly inserts code checking shadow memory before memory accesses. This is faster than outline (in some workloads
@@ -141,6 +151,7 @@ endchoice config KASAN_STACK bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST depends on KASAN_GENERIC || KASAN_SW_TAGS + depends on !ARCH_DISABLE_KASAN_INLINE default y if CC_IS_GCC help The LLVM stack address sanitizer has a know problem that
@@ -154,6 +165,9 @@ config KASAN_STACK but clang users can still enable it for builds without CONFIG_COMPILE_TEST. On gcc it is assumed to always be safe to use and enabled by default. + If the architecture disables inline instrumentation, this is + also disabled as it adds inline-style instrumentation that + is run unconditionally. config KASAN_SW_TAGS_IDENTIFY bool "Enable memory corruption identification"
Signature · 1 line
2.30.2
Re: [PATCH v13 1/3] kasan: allow an architecture to disable inline instrumentation
Quoted 20 lines · Daniel Axtens
For annoying architectural reasons, it's very difficult to support inline instrumentation on powerpc64.*
Add a
Kconfigflag to allow an arch to disable inline. (It's a bit annoying to be 'backwards', but I'm not aware of any way to have an arch force a symbol to be 'n', rather than 'y'.)We also disable stack instrumentation in this case as it does things that are functionally equivalent to inline instrumentation, namely adding code that touches the shadow directly without going through a C helper.
* on ppc64 atm, the shadow lives in virtual memory and isn't accessible in real mode. However, before we turn on virtual memory, we parse the device tree to determine which platform and MMU we're running under. That calls generic DT code, which is instrumented. Inline instrumentation in DT would unconditionally attempt to touch the shadow region, which we won't have set up yet, and would crash. We can make outline mode wait for the arch to be ready, but we can't change what the compiler inserts for inline mode.
Quoted 1 line
Signed-off-by Daniel Axtens <[email protected]>
Thank you.
Quoted 57 lines
--- lib/Kconfig.kasan | 14 ++++++++++++++ 1 file changed, 14 insertions(+)lib/Kconfig.kasan +14
-1@@ -12,6 +12,15 @@ config HAVE_ARCH_KASAN_HW_TAGS config HAVE_ARCH_KASAN_VMALLOC bool +config ARCH_DISABLE_KASAN_INLINE + bool + help + Sometimes an architecture might not be able to support inline + instrumentation but might be able to support outline instrumentation. + This option allows an architecture to prevent inline and stack + instrumentation from being enabled. + + config CC_HAS_KASAN_GENERIC def_bool $(cc-option, -fsanitize=kernel-address)@@ -130,6 +139,7 @@ config KASAN_OUTLINE config KASAN_INLINE bool "Inline instrumentation" + depends on !ARCH_DISABLE_KASAN_INLINE help Compiler directly inserts code checking shadow memory before memory accesses. This is faster than outline (in some workloads@@ -141,6 +151,7 @@ endchoice config KASAN_STACK bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST depends on KASAN_GENERIC || KASAN_SW_TAGS + depends on !ARCH_DISABLE_KASAN_INLINE default y if CC_IS_GCC help The LLVM stack address sanitizer has a know problem that@@ -154,6 +165,9 @@ config KASAN_STACK but clang users can still enable it for builds without CONFIG_COMPILE_TEST. On gcc it is assumed to always be safe to use and enabled by default. + If the architecture disables inline instrumentation, this is + also disabled as it adds inline-style instrumentation that + is run unconditionally. config KASAN_SW_TAGS_IDENTIFY bool "Enable memory corruption identification" --2.30.2
--
You received this message because you are subscribed to the Google Groups "kasan-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20210616080244.51236-2-dja%40axtens.net.
PATCH v13 2/3 kasan: allow architectures to provide an outline readiness check
In reply to Daniel AxtensAllow architectures to define a kasan_arch_is_ready() hook that bails out of any function that's about to touch the shadow unless the arch says that it is ready for the memory to be accessed. This is fairly uninvasive and should have a negligible performance penalty.
This will only work in outline mode, so an arch must specify ARCH_DISABLE_KASAN_INLINE if it requires this.
--
I discuss the justfication for this later in the series. Also, both previous RFCs for ppc64 - by 2 different people - have needed this trick! See:
- https://lore.kernel.org/patchwork/patch/592820/ # ppc64 hash series
- https://patchwork.ozlabs.org/patch/795211/ # ppc radix series
--- mm/kasan/common.c | 4 ++++ mm/kasan/generic.c | 3 +++ mm/kasan/kasan.h | 4 ++++ mm/kasan/shadow.c | 8 ++++++++ 4 files changed, 19 insertions(+)
mm/kasan/common.c +4 -0
@@ -331,6 +331,10 @@ static inline bool ____kasan_slab_free(struct kmem_cache *cache, void *object,u8 tag;void *tagged_object; +/* Bail if the arch isn't ready */ +if (!kasan_arch_is_ready ()) +return false; + tag =get_tag (object); tagged_object = object; object =kasan_reset_tag (object);
mm/kasan/generic.c +3 -0
@@ -163,6 +163,9 @@ static __always_inline bool check_region_inline(unsigned long addr, size_t size, bool write, unsigned long ret_ip) { + if (!kasan_arch_is_ready()) + return true; +if (unlikely (size ==0 ))return true;
mm/kasan/kasan.h +4 -0
@@ -449,6 +449,10 @@ static inline void kasan_poison_last_granule(const void *address, size_t size) {#endif /* CONFIG_KASAN_GENERIC */ +#ifndef kasan_arch_is_ready +static inline bool kasan_arch_is_ready (void ) {return true; } +#endif +/* * Exported functions for interfaces called from assembly or from generated * code. Declarations here to avoid warning about missing declarations.
mm/kasan/shadow.c +8 -0
@@ -73,6 +73,10 @@ void kasan_poison(const void *addr, size_t size, u8 value, bool init) {void *shadow_start, *shadow_end; +/* Don't touch the shadow memory if arch isn't ready */ +if (!kasan_arch_is_ready ()) +return ; +/* * Perform shadow offset calculation based on untagged address, as * some of the callers (e.g. kasan_poison_object_data) pass tagged
@@ -99,6 +103,10 @@ EXPORT_SYMBOL(kasan_poison);#ifdef CONFIG_KASAN_GENERIC void kasan_poison_last_granule (const void *addr,size_t size) { +/* Don't touch the shadow memory if arch isn't ready */ +if (!kasan_arch_is_ready ()) +return ; +if (size &KASAN_GRANULE_MASK ) {u8 *shadow = (u8 *)kasan_mem_to_shadow (addr + size); *shadow = size &KASAN_GRANULE_MASK ;
Signature · 1 line
2.30.2
Re: [PATCH v13 2/3] kasan: allow architectures to provide an outline readiness check
Quoted 5 lines · Daniel Axtens
Allow architectures to define a
kasan_arch_is_ready()hook that bails out of any function that's about to touch the shadow unless the arch says that it is ready for the memory to be accessed. This is fairly uninvasive and should have a negligible performance penalty.
Quoted 7 lines
This will only work in outline mode, so an arch must specify
ARCH_DISABLE_KASAN_INLINEif it requires this.Cc Balbir Singh <[email protected]>Cc Aneesh Kumar K.V <[email protected]>Suggested-by Christophe Leroy <[email protected]>Signed-off-by Daniel Axtens <[email protected]>
but also check if an assertion that this is only used with KASAN_GENERIC might make sense (below). Depends on how much we want to make sure kasan_arch_is_ready() could be useful for other modes (which I don't think it makes sense).
Quoted 48 lines
--
I discuss the justfication for this later in the series. Also, both previous RFCs for ppc64 - by 2 different people - have needed this trick! See:
- https://lore.kernel.org/patchwork/patch/592820/ # ppc64 hash series
- https://patchwork.ozlabs.org/patch/795211/ # ppc radix series--- mm/kasan/common.c | 4 ++++ mm/kasan/generic.c | 3 +++ mm/kasan/kasan.h | 4 ++++ mm/kasan/shadow.c | 8 ++++++++ 4 files changed, 19 insertions(+)mm/kasan/common.c +4
-0@@ -331,6 +331,10 @@ static inline bool ____kasan_slab_free(struct kmem_cache *cache, void *object,u8 tag;void *tagged_object; +/* Bail if the arch isn't ready */ +if (!kasan_arch_is_ready ()) +return false; + tag =get_tag (object); tagged_object = object; object =kasan_reset_tag (object);mm/kasan/generic.c +3
-0@@ -163,6 +163,9 @@ static __always_inline bool check_region_inline(unsigned long addr, size_t size, bool write, unsigned long ret_ip) { + if (!kasan_arch_is_ready()) + return true; +if (unlikely (size ==0 ))return true;mm/kasan/kasan.h +0
-0
mm/kasan/kasan.h static inline void kasan_poison_last_granule(const void *address, size_t size) { · line 455
Quoted 7 lines
mm/kasan/kasan.h +4
-0@@ -449,6 +449,10 @@ static inline void kasan_poison_last_granule(const void *address, size_t size) {#endif /* CONFIG_KASAN_GENERIC */ +#ifndef kasan_arch_is_ready +static inline bool kasan_arch_is_ready (void ) {return true; } +#endif +
I've been trying to think of a way to make it clear this is only for KASAN_GENERIC mode, and not the others. An arch can always define this function, but of course it might not be used. One way would be to add an '#ifndef CONFIG_KASAN_GENERIC' in the #else case and #error if it's not generic mode.
I think trying to make this do anything useful for SW_TAGS or HW_TAGS modes does not make sense (at least right now).
Quoted 36 lines
mm/kasan/kasan.h +0
-0/* * Exported functions for interfaces called from assembly or from generated * code. Declarations here to avoid warning about missing declarations. mm/kasan/shadow.c +8
-1@@ -73,6 +73,10 @@ void kasan_poison(const void *addr, size_t size, u8 value, bool init) {void *shadow_start, *shadow_end; +/* Don't touch the shadow memory if arch isn't ready */ +if (!kasan_arch_is_ready ()) +return ; +/* * Perform shadow offset calculation based on untagged address, as * some of the callers (e.g. kasan_poison_object_data) pass tagged @@ -99,6 +103,10 @@ EXPORT_SYMBOL(kasan_poison);#ifdef CONFIG_KASAN_GENERIC void kasan_poison_last_granule (const void *addr,size_t size) { +/* Don't touch the shadow memory if arch isn't ready */ +if (!kasan_arch_is_ready ()) +return ; +if (size &KASAN_GRANULE_MASK ) {u8 *shadow = (u8 *)kasan_mem_to_shadow (addr + size); *shadow = size &KASAN_GRANULE_MASK ; --2.30.2
--
You received this message because you are subscribed to the Google Groups "kasan-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20210616080244.51236-3-dja%40axtens.net.
PATCH v13 3/3 kasan: define and use MAX_PTRS_PER_* for early shadow tables
In reply to Daniel Axtenspowerpc has a variable number of PTRS_PER_*, set at runtime based on the MMU that the kernel is booted under.
This means the PTRS_PER_* are no longer constants, and therefore breaks the build.
Define default MAX_PTRS_PER_*s in the same style as MAX_PTRS_PER_P4D. As KASAN is the only user at the moment, just define them in the kasan header, and have them default to PTRS_PER_* unless overridden in arch code.
--- include/linux/kasan.h | 18 +++++++++++++++--- mm/kasan/init.c | 6 +++--- 2 files changed, 18 insertions(+), 6 deletions(-)
include/linux/kasan.h +15 -3
@@ -40,10 +40,22 @@ struct kunit_kasan_expectation {#define PTE_HWTABLE_PTRS 0#endif +#ifndef MAX_PTRS_PER_PTE +#define MAX_PTRS_PER_PTE PTRS_PER_PTE +#endif + +#ifndef MAX_PTRS_PER_PMD +#define MAX_PTRS_PER_PMD PTRS_PER_PMD +#endif + +#ifndef MAX_PTRS_PER_PUD +#define MAX_PTRS_PER_PUD PTRS_PER_PUD +#endif +extern unsigned char kasan_early_shadow_page[PAGE_SIZE ]; -extern pte_t kasan_early_shadow_pte[PTRS_PER_PTE +PTE_HWTABLE_PTRS ]; -extern pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD ]; -extern pud_t kasan_early_shadow_pud[PTRS_PER_PUD ]; +extern pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE +PTE_HWTABLE_PTRS ]; +extern pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD ]; +extern pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD ];extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D ]; int kasan_populate_early_shadow(const void *shadow_start,
mm/kasan/init.c +3 -3
@@ -41,7 +41,7 @@ static inline bool kasan_p4d_table(pgd_t pgd) }#endif #if CONFIG_PGTABLE_LEVELS >3 -pud_t kasan_early_shadow_pud[PTRS_PER_PUD] __page_aligned_bss; +pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD] __page_aligned_bss;static inline bool kasan_pud_table (p4d_t p4d) {return p4d_page (p4d) ==virt_to_page (lm_alias (kasan_early_shadow_pud));
@@ -53,7 +53,7 @@ static inline bool kasan_pud_table(p4d_t p4d) }#endif #if CONFIG_PGTABLE_LEVELS >2 -pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD] __page_aligned_bss; +pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD] __page_aligned_bss;static inline bool kasan_pmd_table (pud_t pud) {return pud_page (pud) ==virt_to_page (lm_alias (kasan_early_shadow_pmd));
@@ -64,7 +64,7 @@ static inline bool kasan_pmd_table(pud_t pud)return false; }#endif -pte_t kasan_early_shadow_pte[PTRS_PER_PTE + PTE_HWTABLE_PTRS] +pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE + PTE_HWTABLE_PTRS] __page_aligned_bss;static inline bool kasan_pte_table (pmd_t pmd)
Signature · 1 line
2.30.2
Re: [PATCH v13 3/3] kasan: define and use MAX_PTRS_PER_* for early shadow tables
On Wed, 16 Jun 2021 at 10:03, Daniel Axtens <[email protected]> wrote:
[...]
Quoted 9 lines
include/linux/kasan.h +1
-0@@ -40,10 +40,22 @@ struct kunit_kasan_expectation {#define PTE_HWTABLE_PTRS 0#endif +#ifndef MAX_PTRS_PER_PTE
include/linux/kasan.h struct kunit_kasan_expectation { · line 53
Quoted 10 lines
include/linux/kasan.h +10
-0+#define MAX_PTRS_PER_PTE PTRS_PER_PTE +#endif + +#ifndef MAX_PTRS_PER_PMD +#define MAX_PTRS_PER_PMD PTRS_PER_PMD +#endif + +#ifndef MAX_PTRS_PER_PUD +#define MAX_PTRS_PER_PUD PTRS_PER_PUD +#endif
This is introducing new global constants in a <linux/..> header. It feels like this should be in <linux/pgtable.h> together with a comment. Because <linux/kasan.h> is actually included in <linux/slab.h>, most of the kernel will get these new definitions. That in itself is fine, but it feels wrong that the KASAN header introduces these.
Thoughts?
Sorry for only realizing this now.
Thanks,
-- Marco
Quoted 48 lines
include/linux/kasan.h +3
-3extern unsigned char kasan_early_shadow_page[PAGE_SIZE ]; -extern pte_t kasan_early_shadow_pte[PTRS_PER_PTE +PTE_HWTABLE_PTRS ]; -extern pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD ]; -extern pud_t kasan_early_shadow_pud[PTRS_PER_PUD ]; +extern pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE +PTE_HWTABLE_PTRS ]; +extern pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD ]; +extern pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD ];extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D ]; int kasan_populate_early_shadow(const void *shadow_start,mm/kasan/init.c +3
-4@@ -41,7 +41,7 @@ static inline bool kasan_p4d_table(pgd_t pgd) }#endif #if CONFIG_PGTABLE_LEVELS >3 -pud_t kasan_early_shadow_pud[PTRS_PER_PUD] __page_aligned_bss; +pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD] __page_aligned_bss;static inline bool kasan_pud_table (p4d_t p4d) {return p4d_page (p4d) ==virt_to_page (lm_alias (kasan_early_shadow_pud));@@ -53,7 +53,7 @@ static inline bool kasan_pud_table(p4d_t p4d) }#endif #if CONFIG_PGTABLE_LEVELS >2 -pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD] __page_aligned_bss; +pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD] __page_aligned_bss;static inline bool kasan_pmd_table (pud_t pud) {return pud_page (pud) ==virt_to_page (lm_alias (kasan_early_shadow_pmd));@@ -64,7 +64,7 @@ static inline bool kasan_pmd_table(pud_t pud)return false; }#endif -pte_t kasan_early_shadow_pte[PTRS_PER_PTE + PTE_HWTABLE_PTRS] +pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE + PTE_HWTABLE_PTRS] __page_aligned_bss;static inline bool kasan_pte_table (pmd_t pmd) --2.30.2
--
You received this message because you are subscribed to the Google Groups "kasan-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20210616080244.51236-4-dja%40axtens.net.
Re: [PATCH v13 3/3] kasan: define and use MAX_PTRS_PER_* for early shadow tables
Le 16/06/2021 à 11:07, Marco Elver a écrit :
Quoted 29 lines · Daniel Axtens
[...]
Quoted 9 lines
include/linux/kasan.h +1
-0@@ -40,10 +40,22 @@ struct kunit_kasan_expectation {#define PTE_HWTABLE_PTRS 0#endif +#ifndef MAX_PTRS_PER_PTE include/linux/kasan.h struct kunit_kasan_expectation { · line 53
Quoted 10 lines
include/linux/kasan.h +10
-0+#define MAX_PTRS_PER_PTE PTRS_PER_PTE +#endif + +#ifndef MAX_PTRS_PER_PMD +#define MAX_PTRS_PER_PMD PTRS_PER_PMD +#endif + +#ifndef MAX_PTRS_PER_PUD +#define MAX_PTRS_PER_PUD PTRS_PER_PUD +#endif This is introducing new global constants in a <linux/..> header. It feels like this should be in <
linux/pgtable.h> together with a comment. Because <linux/kasan.h> is actually included in <linux/slab.h>, most of the kernel will get these new definitions. That in itself is fine, but it feels wrong that the KASAN header introduces these.
Quoted 3 lines
Thoughts?
Sorry for only realizing this now.
My idea here was to follow the same road as MAX_PTRS_PER_P4D, added by commit https://github.com/linuxppc/linux/commit/c65e774f
That commit spread MAX_PTRS_PER_P4D everywhere.
Instead of doing the same, we found that it would be better to define a fallback for when the architecture doesn't define MAX_PTRS_PER_PxD . Now, it can be made more global in pgtable.h, in that case I'd suggest to also include MAX_PTRS_PER_P4D in the dance and avoid architectures like s390 having to define it, or even not defining it either in asm-generic/pgtable-nop4d.h
Christophe
Quoted 52 lines
Thanks,
-- MarcoQuoted 48 lines
include/linux/kasan.h +3
-3extern unsigned char kasan_early_shadow_page[PAGE_SIZE ]; -extern pte_t kasan_early_shadow_pte[PTRS_PER_PTE +PTE_HWTABLE_PTRS ]; -extern pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD ]; -extern pud_t kasan_early_shadow_pud[PTRS_PER_PUD ]; +extern pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE +PTE_HWTABLE_PTRS ]; +extern pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD ]; +extern pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD ];extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D ]; int kasan_populate_early_shadow(const void *shadow_start,mm/kasan/init.c +3
-4@@ -41,7 +41,7 @@ static inline bool kasan_p4d_table(pgd_t pgd) }#endif #if CONFIG_PGTABLE_LEVELS >3 -pud_t kasan_early_shadow_pud[PTRS_PER_PUD] __page_aligned_bss; +pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD] __page_aligned_bss;static inline bool kasan_pud_table (p4d_t p4d) {return p4d_page (p4d) ==virt_to_page (lm_alias (kasan_early_shadow_pud));@@ -53,7 +53,7 @@ static inline bool kasan_pud_table(p4d_t p4d) }#endif #if CONFIG_PGTABLE_LEVELS >2 -pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD] __page_aligned_bss; +pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD] __page_aligned_bss;static inline bool kasan_pmd_table (pud_t pud) {return pud_page (pud) ==virt_to_page (lm_alias (kasan_early_shadow_pmd));@@ -64,7 +64,7 @@ static inline bool kasan_pmd_table(pud_t pud)return false; }#endif -pte_t kasan_early_shadow_pte[PTRS_PER_PTE + PTE_HWTABLE_PTRS] +pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE + PTE_HWTABLE_PTRS] __page_aligned_bss;static inline bool kasan_pte_table (pmd_t pmd) --2.30.2
--
You received this message because you are subscribed to the Google Groups "kasan-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20210616080244.51236-4-dja%40axtens.net.