* [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE
@ 2022-02-02 8:44 Christophe Leroy
2022-02-02 8:44 ` [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry() Christophe Leroy
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Christophe Leroy @ 2022-02-02 8:44 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
Dmitry Vyukov, Andrew Morton
Cc: Christophe Leroy, linux-kernel, linux-mm, linux-hardening, kasan-dev
Many many places check whether there is one of
CONFIG_KASAN_GENERIC or CONFIG_KASAN_SW_TAGS
In order to avoid adding more places with such a awful
check, add CONFIG_KASAN_SOFTWARE which is selected by
both CONFIG_KASAN_GENERIC and CONFIG_KASAN_SW_TAGS.
This patch only modifies core part. Arch specific parts
can be upgraded one by one in a second step.
Don't change mm/ptdump.c as those #ifdefs go away in
the patch after the next.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
include/linux/fortify-string.h | 2 +-
include/linux/kasan-checks.h | 2 +-
include/linux/kasan.h | 13 ++++++-------
include/linux/moduleloader.h | 3 +--
include/linux/sched.h | 2 +-
include/linux/vmalloc.h | 3 +--
init/init_task.c | 2 +-
lib/Kconfig.kasan | 9 +++++++--
mm/kasan/Makefile | 5 +++--
mm/kasan/common.c | 4 ++--
mm/kasan/kasan.h | 8 ++++----
mm/kasan/report.c | 2 +-
12 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index a6cd6815f249..65c06e30fc6b 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -24,7 +24,7 @@ void __write_overflow(void) __compiletime_error("detected write beyond size of o
__ret; \
})
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
extern void *__underlying_memchr(const void *p, int c, __kernel_size_t size) __RENAME(memchr);
extern int __underlying_memcmp(const void *p, const void *q, __kernel_size_t size) __RENAME(memcmp);
extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(memcpy);
diff --git a/include/linux/kasan-checks.h b/include/linux/kasan-checks.h
index 3d6d22a25bdc..7ad385c4b2fc 100644
--- a/include/linux/kasan-checks.h
+++ b/include/linux/kasan-checks.h
@@ -15,7 +15,7 @@
* even in compilation units that selectively disable KASAN, but must use KASAN
* to validate access to an address. Never use these in header files!
*/
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
bool __kasan_check_read(const volatile void *p, unsigned int size);
bool __kasan_check_write(const volatile void *p, unsigned int size);
#else
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 4a45562d8893..c29778b25d8a 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -25,7 +25,7 @@ struct kunit_kasan_expectation {
#endif
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
#include <linux/pgtable.h>
@@ -66,7 +66,7 @@ extern void kasan_enable_current(void);
/* Disable reporting bugs for current task */
extern void kasan_disable_current(void);
-#else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+#else /* CONFIG_KASAN_SOFTWARE */
static inline int kasan_add_zero_shadow(void *start, unsigned long size)
{
@@ -79,7 +79,7 @@ static inline void kasan_remove_zero_shadow(void *start,
static inline void kasan_enable_current(void) {}
static inline void kasan_disable_current(void) {}
-#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+#endif /* CONFIG_KASAN_SOFTWARE */
#ifdef CONFIG_KASAN_HW_TAGS
@@ -467,8 +467,7 @@ static inline void kasan_populate_early_vm_area_shadow(void *start,
#endif /* CONFIG_KASAN_VMALLOC */
-#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \
- !defined(CONFIG_KASAN_VMALLOC)
+#if defined(CONFIG_KASAN_SOFTWARE) && !defined(CONFIG_KASAN_VMALLOC)
/*
* These functions provide a special case to support backing module
@@ -478,12 +477,12 @@ static inline void kasan_populate_early_vm_area_shadow(void *start,
int kasan_module_alloc(void *addr, size_t size, gfp_t gfp_mask);
void kasan_free_shadow(const struct vm_struct *vm);
-#else /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */
+#else /* CONFIG_KASAN_SOFTWARE && !CONFIG_KASAN_VMALLOC */
static inline int kasan_module_alloc(void *addr, size_t size, gfp_t gfp_mask) { return 0; }
static inline void kasan_free_shadow(const struct vm_struct *vm) {}
-#endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */
+#endif /* CONFIG_KASAN_SOFTWARE && !CONFIG_KASAN_VMALLOC */
#ifdef CONFIG_KASAN_INLINE
void kasan_non_canonical_hook(unsigned long addr);
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index 9e09d11ffe5b..232687e315b3 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -96,8 +96,7 @@ void module_arch_cleanup(struct module *mod);
/* Any cleanup before freeing mod->module_init */
void module_arch_freeing_init(struct module *mod);
-#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \
- !defined(CONFIG_KASAN_VMALLOC)
+#if defined(CONFIG_KASAN_SOFTWARE) && !defined(CONFIG_KASAN_VMALLOC)
#include <linux/kasan.h>
#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
#else
diff --git a/include/linux/sched.h b/include/linux/sched.h
index f5b2be39a78c..8d815aea1009 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1335,7 +1335,7 @@ struct task_struct {
u64 timer_slack_ns;
u64 default_timer_slack_ns;
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
unsigned int kasan_depth;
#endif
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 880227b9f044..83d870b16a31 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -28,8 +28,7 @@ struct notifier_block; /* in notifier.h */
#define VM_MAP_PUT_PAGES 0x00000200 /* put pages and free array in vfree */
#define VM_NO_HUGE_VMAP 0x00000400 /* force PAGE_SIZE pte mapping */
-#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \
- !defined(CONFIG_KASAN_VMALLOC)
+#if defined(CONFIG_KASAN_SOFTWARE) && !defined(CONFIG_KASAN_VMALLOC)
#define VM_DEFER_KMEMLEAK 0x00000800 /* defer kmemleak object creation */
#else
#define VM_DEFER_KMEMLEAK 0
diff --git a/init/init_task.c b/init/init_task.c
index 73cc8f03511a..fa924e5ae173 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -177,7 +177,7 @@ struct task_struct init_task
.numa_group = NULL,
.numa_faults = NULL,
#endif
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
.kasan_depth = 1,
#endif
#ifdef CONFIG_KCSAN
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 879757b6dd14..4b2de3bd188a 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -46,6 +46,9 @@ menuconfig KASAN
if KASAN
+config KASAN_SOFTWARE
+ bool
+
choice
prompt "KASAN mode"
default KASAN_GENERIC
@@ -69,6 +72,7 @@ config KASAN_GENERIC
depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS
select SLUB_DEBUG if SLUB
select CONSTRUCTORS
+ select KASAN_SOFTWARE
help
Enables generic KASAN mode.
@@ -90,6 +94,7 @@ config KASAN_SW_TAGS
depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS
select SLUB_DEBUG if SLUB
select CONSTRUCTORS
+ select KASAN_SOFTWARE
help
Enables software tag-based KASAN mode.
@@ -125,7 +130,7 @@ endchoice
choice
prompt "Instrumentation type"
- depends on KASAN_GENERIC || KASAN_SW_TAGS
+ depends on KASAN_SOFTWARE
default KASAN_OUTLINE
config KASAN_OUTLINE
@@ -150,7 +155,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 KASAN_SOFTWARE
depends on !ARCH_DISABLE_KASAN_INLINE
default y if CC_IS_GCC
help
diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
index adcd9acaef61..5f22899b3b2b 100644
--- a/mm/kasan/Makefile
+++ b/mm/kasan/Makefile
@@ -36,6 +36,7 @@ CFLAGS_hw_tags.o := $(CC_FLAGS_KASAN_RUNTIME)
CFLAGS_sw_tags.o := $(CC_FLAGS_KASAN_RUNTIME)
obj-$(CONFIG_KASAN) := common.o report.o
-obj-$(CONFIG_KASAN_GENERIC) += init.o generic.o report_generic.o shadow.o quarantine.o
+obj-$(CONFIG_KASAN_SOFTWARE) += init.o shadow.o
+obj-$(CONFIG_KASAN_GENERIC) += generic.o report_generic.o quarantine.o
obj-$(CONFIG_KASAN_HW_TAGS) += hw_tags.o report_hw_tags.o tags.o report_tags.o
-obj-$(CONFIG_KASAN_SW_TAGS) += init.o report_sw_tags.o shadow.o sw_tags.o tags.o report_tags.o
+obj-$(CONFIG_KASAN_SW_TAGS) += sw_tags.o report_sw_tags.o tags.o report_tags.o
diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 92196562687b..5693fe2c176f 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -45,7 +45,7 @@ void kasan_set_track(struct kasan_track *track, gfp_t flags)
track->stack = kasan_save_stack(flags, true);
}
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
void kasan_enable_current(void)
{
current->kasan_depth++;
@@ -58,7 +58,7 @@ void kasan_disable_current(void)
}
EXPORT_SYMBOL(kasan_disable_current);
-#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+#endif /* CONFIG_KASAN_SOFTWARE */
void __kasan_unpoison_range(const void *address, size_t size)
{
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index c17fa8d26ffe..57d96714bc1b 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -55,7 +55,7 @@ static inline bool kasan_sync_fault_possible(void)
#endif
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
#define KASAN_GRANULE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT)
#else
#include <asm/mte-kasan.h>
@@ -211,7 +211,7 @@ struct kasan_free_meta *kasan_get_free_meta(struct kmem_cache *cache,
const void *object);
#endif
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
{
@@ -235,14 +235,14 @@ static inline bool addr_has_metadata(const void *addr)
bool kasan_check_range(unsigned long addr, size_t size, bool write,
unsigned long ret_ip);
-#else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+#else /* CONFIG_KASAN_SOFTWARE */
static inline bool addr_has_metadata(const void *addr)
{
return (is_vmalloc_addr(addr) || virt_addr_valid(addr));
}
-#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+#endif /* CONFIG_KASAN_SOFTWARE */
#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
void kasan_print_tags(u8 addr_tag, const void *addr);
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 3ad9624dcc56..bce57bbd1baa 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -334,7 +334,7 @@ static void print_memory_metadata(const void *addr)
static bool report_enabled(void)
{
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
+#ifdef CONFIG_KASAN_SOFTWARE
if (current->kasan_depth)
return false;
#endif
--
2.33.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry()
2022-02-02 8:44 [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE Christophe Leroy
@ 2022-02-02 8:44 ` Christophe Leroy
2022-02-02 12:48 ` kernel test robot
2022-02-02 12:49 ` kernel test robot
2022-02-02 8:45 ` [PATCH 3/4] powerpc/ptdump: Use kasan_pXX_table() Christophe Leroy
` (2 subsequent siblings)
3 siblings, 2 replies; 7+ messages in thread
From: Christophe Leroy @ 2022-02-02 8:44 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
Dmitry Vyukov, Andrew Morton
Cc: Christophe Leroy, linux-kernel, linux-mm, linux-hardening, kasan-dev
In order to reuse them outside of mm/kasan/init.c, move the
following helpers outside of init.c:
kasan_p4d_table()
kasan_pud_table()
kasan_pmd_table()
kasan_pte_table()
kasan_early_shadow_page_entry()
And make them available when KASAN is not selected.
Inclusion of kasan.h in mm.h needs to be moved down a bit
in order to get lm_alias() definition.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
include/linux/kasan.h | 57 +++++++++++++++++++++++++++++++++++++++++++
include/linux/mm.h | 3 ++-
mm/kasan/init.c | 37 ----------------------------
3 files changed, 59 insertions(+), 38 deletions(-)
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index c29778b25d8a..1629797198ec 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -28,6 +28,7 @@ struct kunit_kasan_expectation {
#ifdef CONFIG_KASAN_SOFTWARE
#include <linux/pgtable.h>
+#include <linux/mm.h>
/* Software KASAN implementations use shadow memory. */
@@ -81,6 +82,62 @@ static inline void kasan_disable_current(void) {}
#endif /* CONFIG_KASAN_SOFTWARE */
+#if defined(CONFIG_KASAN_SOFTWARE) && CONFIG_PGTABLE_LEVELS > 4
+static inline bool kasan_p4d_table(pgd_t pgd)
+{
+ return pgd_page(pgd) == virt_to_page(lm_alias(kasan_early_shadow_p4d));
+}
+#else
+static inline bool kasan_p4d_table(pgd_t pgd)
+{
+ return false;
+}
+#endif
+#if defined(CONFIG_KASAN_SOFTWARE) && CONFIG_PGTABLE_LEVELS > 3
+static inline bool kasan_pud_table(p4d_t p4d)
+{
+ return p4d_page(p4d) == virt_to_page(lm_alias(kasan_early_shadow_pud));
+}
+#else
+static inline bool kasan_pud_table(p4d_t p4d)
+{
+ return false;
+}
+#endif
+#if defined(CONFIG_KASAN_SOFTWARE) && CONFIG_PGTABLE_LEVELS > 2
+static inline bool kasan_pmd_table(pud_t pud)
+{
+ return pud_page(pud) == virt_to_page(lm_alias(kasan_early_shadow_pmd));
+}
+#else
+static inline bool kasan_pmd_table(pud_t pud)
+{
+ return false;
+}
+#endif
+
+#ifdef CONFIG_KASAN_SOFTWARE
+static inline bool kasan_pte_table(pmd_t pmd)
+{
+ return pmd_page(pmd) == virt_to_page(lm_alias(kasan_early_shadow_pte));
+}
+
+static inline bool kasan_early_shadow_page_entry(pte_t pte)
+{
+ return pte_page(pte) == virt_to_page(lm_alias(kasan_early_shadow_page));
+}
+#else
+static inline bool kasan_pte_table(pmd_t pmd)
+{
+ return false;
+}
+
+static inline bool kasan_early_shadow_page_entry(pte_t pte)
+{
+ return false;
+}
+#endif
+
#ifdef CONFIG_KASAN_HW_TAGS
DECLARE_STATIC_KEY_FALSE(kasan_flag_enabled);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e1a84b1e6787..b06ee84b3717 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -31,7 +31,6 @@
#include <linux/sizes.h>
#include <linux/sched.h>
#include <linux/pgtable.h>
-#include <linux/kasan.h>
struct mempolicy;
struct anon_vma;
@@ -121,6 +120,8 @@ extern int mmap_rnd_compat_bits __read_mostly;
#define lm_alias(x) __va(__pa_symbol(x))
#endif
+#include <linux/kasan.h>
+
/*
* To prevent common memory management code establishing
* a zero page mapping on a read fault.
diff --git a/mm/kasan/init.c b/mm/kasan/init.c
index cc64ed6858c6..e863071a49ef 100644
--- a/mm/kasan/init.c
+++ b/mm/kasan/init.c
@@ -30,53 +30,16 @@ unsigned char kasan_early_shadow_page[PAGE_SIZE] __page_aligned_bss;
#if CONFIG_PGTABLE_LEVELS > 4
p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D] __page_aligned_bss;
-static inline bool kasan_p4d_table(pgd_t pgd)
-{
- return pgd_page(pgd) == virt_to_page(lm_alias(kasan_early_shadow_p4d));
-}
-#else
-static inline bool kasan_p4d_table(pgd_t pgd)
-{
- return false;
-}
#endif
#if CONFIG_PGTABLE_LEVELS > 3
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));
-}
-#else
-static inline bool kasan_pud_table(p4d_t p4d)
-{
- return false;
-}
#endif
#if CONFIG_PGTABLE_LEVELS > 2
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));
-}
-#else
-static inline bool kasan_pmd_table(pud_t pud)
-{
- return false;
-}
#endif
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)
-{
- return pmd_page(pmd) == virt_to_page(lm_alias(kasan_early_shadow_pte));
-}
-
-static inline bool kasan_early_shadow_page_entry(pte_t pte)
-{
- return pte_page(pte) == virt_to_page(lm_alias(kasan_early_shadow_page));
-}
-
static __init void *early_alloc(size_t size, int node)
{
void *ptr = memblock_alloc_try_nid(size, size, __pa(MAX_DMA_ADDRESS),
--
2.33.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] powerpc/ptdump: Use kasan_pXX_table()
2022-02-02 8:44 [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE Christophe Leroy
2022-02-02 8:44 ` [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry() Christophe Leroy
@ 2022-02-02 8:45 ` Christophe Leroy
2022-02-02 8:45 ` [PATCH 4/4] [RFC] risc/kasan: " Christophe Leroy
2022-02-02 13:50 ` [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE kernel test robot
3 siblings, 0 replies; 7+ messages in thread
From: Christophe Leroy @ 2022-02-02 8:45 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
Dmitry Vyukov, Andrew Morton
Cc: Christophe Leroy, linux-kernel, linux-mm, linux-hardening, kasan-dev
Instead of opencoding, use the new kasan_pXX_table() helpers.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
mm/ptdump.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/mm/ptdump.c b/mm/ptdump.c
index da751448d0e4..bb6782de8203 100644
--- a/mm/ptdump.c
+++ b/mm/ptdump.c
@@ -4,7 +4,6 @@
#include <linux/ptdump.h>
#include <linux/kasan.h>
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
/*
* This is an optimization for KASAN=y case. Since all kasan page tables
* eventually point to the kasan_early_shadow_page we could call note_page()
@@ -15,15 +14,16 @@
static inline int note_kasan_page_table(struct mm_walk *walk,
unsigned long addr)
{
+#ifdef CONFIG_KASAN_SOFTWARE
struct ptdump_state *st = walk->private;
st->note_page(st, addr, 4, pte_val(kasan_early_shadow_pte[0]));
walk->action = ACTION_CONTINUE;
+#endif
return 0;
}
-#endif
static int ptdump_pgd_entry(pgd_t *pgd, unsigned long addr,
unsigned long next, struct mm_walk *walk)
@@ -31,11 +31,8 @@ static int ptdump_pgd_entry(pgd_t *pgd, unsigned long addr,
struct ptdump_state *st = walk->private;
pgd_t val = READ_ONCE(*pgd);
-#if CONFIG_PGTABLE_LEVELS > 4 && \
- (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS))
- if (pgd_page(val) == virt_to_page(lm_alias(kasan_early_shadow_p4d)))
+ if (kasan_p4d_table(val))
return note_kasan_page_table(walk, addr);
-#endif
if (st->effective_prot)
st->effective_prot(st, 0, pgd_val(val));
@@ -52,11 +49,8 @@ static int ptdump_p4d_entry(p4d_t *p4d, unsigned long addr,
struct ptdump_state *st = walk->private;
p4d_t val = READ_ONCE(*p4d);
-#if CONFIG_PGTABLE_LEVELS > 3 && \
- (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS))
- if (p4d_page(val) == virt_to_page(lm_alias(kasan_early_shadow_pud)))
+ if (kasan_pud_table(val))
return note_kasan_page_table(walk, addr);
-#endif
if (st->effective_prot)
st->effective_prot(st, 1, p4d_val(val));
@@ -73,11 +67,8 @@ static int ptdump_pud_entry(pud_t *pud, unsigned long addr,
struct ptdump_state *st = walk->private;
pud_t val = READ_ONCE(*pud);
-#if CONFIG_PGTABLE_LEVELS > 2 && \
- (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS))
- if (pud_page(val) == virt_to_page(lm_alias(kasan_early_shadow_pmd)))
+ if (kasan_pmd_table(val))
return note_kasan_page_table(walk, addr);
-#endif
if (st->effective_prot)
st->effective_prot(st, 2, pud_val(val));
@@ -94,10 +85,8 @@ static int ptdump_pmd_entry(pmd_t *pmd, unsigned long addr,
struct ptdump_state *st = walk->private;
pmd_t val = READ_ONCE(*pmd);
-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
- if (pmd_page(val) == virt_to_page(lm_alias(kasan_early_shadow_pte)))
+ if (kasan_pte_table(val))
return note_kasan_page_table(walk, addr);
-#endif
if (st->effective_prot)
st->effective_prot(st, 3, pmd_val(val));
--
2.33.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] [RFC] risc/kasan: Use kasan_pXX_table()
2022-02-02 8:44 [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE Christophe Leroy
2022-02-02 8:44 ` [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry() Christophe Leroy
2022-02-02 8:45 ` [PATCH 3/4] powerpc/ptdump: Use kasan_pXX_table() Christophe Leroy
@ 2022-02-02 8:45 ` Christophe Leroy
2022-02-02 13:50 ` [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE kernel test robot
3 siblings, 0 replies; 7+ messages in thread
From: Christophe Leroy @ 2022-02-02 8:45 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov,
Dmitry Vyukov, Andrew Morton
Cc: Christophe Leroy, linux-kernel, linux-mm, linux-hardening,
kasan-dev, Paul Walmsley, Palmer Dabbelt, Albert Ou
Instead of opencoding, use the new kasan_pXX_table() helpers.
Add kasan_pgd_next_table() to make things similar to other
levels.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
---
Sent as an RFC as I don't have any risc setup to test it.
---
arch/riscv/mm/kasan_init.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c
index f61f7ca6fe0f..f82d8b73f518 100644
--- a/arch/riscv/mm/kasan_init.c
+++ b/arch/riscv/mm/kasan_init.c
@@ -61,13 +61,10 @@ static void __init kasan_populate_pmd(pud_t *pud, unsigned long vaddr, unsigned
pmd_t *pmdp, *base_pmd;
unsigned long next;
- if (pud_none(*pud)) {
+ if (pud_none(*pud) || kasan_pmd_table(*pud))
base_pmd = memblock_alloc(PTRS_PER_PMD * sizeof(pmd_t), PAGE_SIZE);
- } else {
+ else
base_pmd = (pmd_t *)pud_pgtable(*pud);
- if (base_pmd == lm_alias(kasan_early_shadow_pmd))
- base_pmd = memblock_alloc(PTRS_PER_PMD * sizeof(pmd_t), PAGE_SIZE);
- }
pmdp = base_pmd + pmd_index(vaddr);
@@ -112,9 +109,10 @@ static void __init kasan_populate_pud(pgd_t *pgd,
*/
base_pud = pt_ops.get_pud_virt(pfn_to_phys(_pgd_pfn(*pgd)));
} else {
- base_pud = (pud_t *)pgd_page_vaddr(*pgd);
- if (base_pud == lm_alias(kasan_early_shadow_pud))
+ if (kasan_pud_table(*pgd))
base_pud = memblock_alloc(PTRS_PER_PUD * sizeof(pud_t), PAGE_SIZE);
+ else
+ base_pud = (pud_t *)pgd_page_vaddr(*pgd);
}
pudp = base_pud + pud_index(vaddr);
@@ -157,6 +155,11 @@ static void __init kasan_populate_pud(pgd_t *pgd,
kasan_populate_pud(pgdp, vaddr, next, early) : \
kasan_populate_pmd((pud_t *)pgdp, vaddr, next))
+static inline bool kasan_pgd_next_table(pgd_t pgd)
+{
+ return pgd_page(pgd) == virt_to_page(lm_alias(kasan_early_shadow_pgd_next));
+}
+
static void __init kasan_populate_pgd(pgd_t *pgdp,
unsigned long vaddr, unsigned long end,
bool early)
@@ -172,8 +175,7 @@ static void __init kasan_populate_pgd(pgd_t *pgdp,
phys_addr = __pa((uintptr_t)kasan_early_shadow_pgd_next);
set_pgd(pgdp, pfn_pgd(PFN_DOWN(phys_addr), PAGE_TABLE));
continue;
- } else if (pgd_page_vaddr(*pgdp) ==
- (unsigned long)lm_alias(kasan_early_shadow_pgd_next)) {
+ } else if (kasan_pgd_next_table(*pgdp)) {
/*
* pgdp can't be none since kasan_early_init
* initialized all KASAN shadow region with
@@ -251,7 +253,6 @@ static void __init kasan_shallow_populate_pud(pgd_t *pgdp,
unsigned long next;
pud_t *pudp, *base_pud;
pmd_t *base_pmd;
- bool is_kasan_pmd;
base_pud = (pud_t *)pgd_page_vaddr(*pgdp);
pudp = base_pud + pud_index(vaddr);
@@ -262,9 +263,8 @@ static void __init kasan_shallow_populate_pud(pgd_t *pgdp,
do {
next = pud_addr_end(vaddr, end);
- is_kasan_pmd = (pud_pgtable(*pudp) == lm_alias(kasan_early_shadow_pmd));
- if (is_kasan_pmd) {
+ if (kasan_pmd_table(*pudp)) {
base_pmd = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
set_pud(pudp, pfn_pud(PFN_DOWN(__pa(base_pmd)), PAGE_TABLE));
}
@@ -280,8 +280,7 @@ static void __init kasan_shallow_populate_pgd(unsigned long vaddr, unsigned long
do {
next = pgd_addr_end(vaddr, end);
- is_kasan_pgd_next = (pgd_page_vaddr(*pgd_k) ==
- (unsigned long)lm_alias(kasan_early_shadow_pgd_next));
+ is_kasan_pgd_next = kasan_pgd_next_table(*pgd_k);
if (is_kasan_pgd_next) {
p = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
--
2.33.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry()
2022-02-02 8:44 ` [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry() Christophe Leroy
@ 2022-02-02 12:48 ` kernel test robot
2022-02-02 12:49 ` kernel test robot
1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-02 12:48 UTC (permalink / raw)
To: Christophe Leroy, Andrey Ryabinin, Alexander Potapenko,
Andrey Konovalov, Dmitry Vyukov, Andrew Morton
Cc: kbuild-all, Linux Memory Management List, Christophe Leroy,
linux-kernel, linux-hardening, kasan-dev
Hi Christophe,
I love your patch! Yet something to improve:
[auto build test ERROR on tip/sched/core]
[also build test ERROR on linus/master v5.17-rc2]
[cannot apply to hnaz-mm/master next-20220202]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Christophe-Leroy/mm-kasan-Add-CONFIG_KASAN_SOFTWARE/20220202-164612
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git ec2444530612a886b406e2830d7f314d1a07d4bb
config: riscv-randconfig-r042-20220130 (https://download.01.org/0day-ci/archive/20220202/202202022041.mkJKLdPP-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/23eabd57613c3b304c1c54f1133ef5376cf5731d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christophe-Leroy/mm-kasan-Add-CONFIG_KASAN_SOFTWARE/20220202-164612
git checkout 23eabd57613c3b304c1c54f1133ef5376cf5731d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=riscv SHELL=/bin/bash kernel/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/slab.h:136,
from kernel/fork.c:16:
>> include/linux/kasan.h:102:36: error: unknown type name 'p4d_t'; did you mean 'pgd_t'?
102 | static inline bool kasan_pud_table(p4d_t p4d)
| ^~~~~
| pgd_t
>> include/linux/kasan.h:113:36: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
113 | static inline bool kasan_pmd_table(pud_t pud)
| ^~~~~
| pgd_t
>> include/linux/kasan.h:130:36: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
130 | static inline bool kasan_pte_table(pmd_t pmd)
| ^~~~~
| pgd_t
kernel/fork.c:162:13: warning: no previous prototype for 'arch_release_task_struct' [-Wmissing-prototypes]
162 | void __weak arch_release_task_struct(struct task_struct *tsk)
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/fork.c:764:20: warning: no previous prototype for 'arch_task_cache_init' [-Wmissing-prototypes]
764 | void __init __weak arch_task_cache_init(void) { }
| ^~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/slab.h:136,
from kernel/resource.c:17:
>> include/linux/kasan.h:102:36: error: unknown type name 'p4d_t'; did you mean 'pgd_t'?
102 | static inline bool kasan_pud_table(p4d_t p4d)
| ^~~~~
| pgd_t
>> include/linux/kasan.h:113:36: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
113 | static inline bool kasan_pmd_table(pud_t pud)
| ^~~~~
| pgd_t
>> include/linux/kasan.h:130:36: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
130 | static inline bool kasan_pte_table(pmd_t pmd)
| ^~~~~
| pgd_t
--
In file included from include/linux/slab.h:136,
from include/linux/resource_ext.h:11,
from include/linux/acpi.h:14,
from kernel/irq/irqdomain.c:5:
>> include/linux/kasan.h:102:36: error: unknown type name 'p4d_t'; did you mean 'pgd_t'?
102 | static inline bool kasan_pud_table(p4d_t p4d)
| ^~~~~
| pgd_t
>> include/linux/kasan.h:113:36: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
113 | static inline bool kasan_pmd_table(pud_t pud)
| ^~~~~
| pgd_t
>> include/linux/kasan.h:130:36: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
130 | static inline bool kasan_pte_table(pmd_t pmd)
| ^~~~~
| pgd_t
kernel/irq/irqdomain.c:1918:13: warning: no previous prototype for 'irq_domain_debugfs_init' [-Wmissing-prototypes]
1918 | void __init irq_domain_debugfs_init(struct dentry *root)
| ^~~~~~~~~~~~~~~~~~~~~~~
vim +102 include/linux/kasan.h
84
85 #if defined(CONFIG_KASAN_SOFTWARE) && CONFIG_PGTABLE_LEVELS > 4
86 static inline bool kasan_p4d_table(pgd_t pgd)
87 {
88 return pgd_page(pgd) == virt_to_page(lm_alias(kasan_early_shadow_p4d));
89 }
90 #else
91 static inline bool kasan_p4d_table(pgd_t pgd)
92 {
93 return false;
94 }
95 #endif
96 #if defined(CONFIG_KASAN_SOFTWARE) && CONFIG_PGTABLE_LEVELS > 3
97 static inline bool kasan_pud_table(p4d_t p4d)
98 {
99 return p4d_page(p4d) == virt_to_page(lm_alias(kasan_early_shadow_pud));
100 }
101 #else
> 102 static inline bool kasan_pud_table(p4d_t p4d)
103 {
104 return false;
105 }
106 #endif
107 #if defined(CONFIG_KASAN_SOFTWARE) && CONFIG_PGTABLE_LEVELS > 2
108 static inline bool kasan_pmd_table(pud_t pud)
109 {
110 return pud_page(pud) == virt_to_page(lm_alias(kasan_early_shadow_pmd));
111 }
112 #else
> 113 static inline bool kasan_pmd_table(pud_t pud)
114 {
115 return false;
116 }
117 #endif
118
119 #ifdef CONFIG_KASAN_SOFTWARE
120 static inline bool kasan_pte_table(pmd_t pmd)
121 {
122 return pmd_page(pmd) == virt_to_page(lm_alias(kasan_early_shadow_pte));
123 }
124
125 static inline bool kasan_early_shadow_page_entry(pte_t pte)
126 {
127 return pte_page(pte) == virt_to_page(lm_alias(kasan_early_shadow_page));
128 }
129 #else
> 130 static inline bool kasan_pte_table(pmd_t pmd)
131 {
132 return false;
133 }
134
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry()
2022-02-02 8:44 ` [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry() Christophe Leroy
2022-02-02 12:48 ` kernel test robot
@ 2022-02-02 12:49 ` kernel test robot
1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-02 12:49 UTC (permalink / raw)
To: Christophe Leroy, Andrey Ryabinin, Alexander Potapenko,
Andrey Konovalov, Dmitry Vyukov, Andrew Morton
Cc: llvm, kbuild-all, Linux Memory Management List, Christophe Leroy,
linux-kernel, linux-hardening, kasan-dev
Hi Christophe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/sched/core]
[also build test WARNING on linus/master v5.17-rc2]
[cannot apply to hnaz-mm/master next-20220202]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Christophe-Leroy/mm-kasan-Add-CONFIG_KASAN_SOFTWARE/20220202-164612
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git ec2444530612a886b406e2830d7f314d1a07d4bb
config: mips-cu1000-neo_defconfig (https://download.01.org/0day-ci/archive/20220202/202202022037.dX0aClQq-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6b1e844b69f15bb7dffaf9365cd2b355d2eb7579)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/23eabd57613c3b304c1c54f1133ef5376cf5731d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christophe-Leroy/mm-kasan-Add-CONFIG_KASAN_SOFTWARE/20220202-164612
git checkout 23eabd57613c3b304c1c54f1133ef5376cf5731d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/irqchip/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/irqchip/irq-ingenic.c:10:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/mips/include/asm/hardirq.h:16:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:21:
In file included from include/linux/slab.h:136:
include/linux/kasan.h:102:36: error: unknown type name 'p4d_t'
static inline bool kasan_pud_table(p4d_t p4d)
^
include/linux/kasan.h:113:36: error: unknown type name 'pud_t'
static inline bool kasan_pmd_table(pud_t pud)
^
include/linux/kasan.h:130:36: error: unknown type name 'pmd_t'
static inline bool kasan_pte_table(pmd_t pmd)
^
>> drivers/irqchip/irq-ingenic.c:111:22: warning: shift count >= width of type [-Wshift-count-overflow]
gc->wake_enabled = IRQ_MSK(32);
^~~~~~~~~~~
include/linux/irq.h:1175:41: note: expanded from macro 'IRQ_MSK'
#define IRQ_MSK(n) (u32)((n) < 32 ? ((1 << (n)) - 1) : UINT_MAX)
^ ~~~
drivers/irqchip/irq-ingenic.c:124:22: warning: shift count >= width of type [-Wshift-count-overflow]
irq_reg_writel(gc, IRQ_MSK(32), JZ_REG_INTC_SET_MASK);
^~~~~~~~~~~
include/linux/irq.h:1175:41: note: expanded from macro 'IRQ_MSK'
#define IRQ_MSK(n) (u32)((n) < 32 ? ((1 << (n)) - 1) : UINT_MAX)
^ ~~~
2 warnings and 3 errors generated.
vim +111 drivers/irqchip/irq-ingenic.c
42b64f388c171a arch/mips/jz4740/irq.c Thomas Gleixner 2011-03-23 59
943d69c6c21746 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 60 static int __init ingenic_intc_of_init(struct device_node *node,
943d69c6c21746 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 61 unsigned num_chips)
9869848d12601c arch/mips/jz4740/irq.c Lars-Peter Clausen 2010-07-17 62 {
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 63 struct ingenic_intc_data *intc;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 64 struct irq_chip_generic *gc;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 65 struct irq_chip_type *ct;
638c885185dc2e arch/mips/jz4740/irq.c Paul Burton 2015-05-24 66 struct irq_domain *domain;
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 67 int parent_irq, err = 0;
943d69c6c21746 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 68 unsigned i;
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 69
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 70 intc = kzalloc(sizeof(*intc), GFP_KERNEL);
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 71 if (!intc) {
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 72 err = -ENOMEM;
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 73 goto out_err;
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 74 }
69ce4b2288d22a arch/mips/jz4740/irq.c Paul Burton 2015-05-24 75
69ce4b2288d22a arch/mips/jz4740/irq.c Paul Burton 2015-05-24 76 parent_irq = irq_of_parse_and_map(node, 0);
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 77 if (!parent_irq) {
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 78 err = -EINVAL;
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 79 goto out_free;
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 80 }
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 81
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 82 err = irq_set_handler_data(parent_irq, intc);
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 83 if (err)
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 84 goto out_unmap_irq;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 85
943d69c6c21746 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 86 intc->num_chips = num_chips;
3aa94590e7bf82 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 87 intc->base = of_iomap(node, 0);
3aa94590e7bf82 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 88 if (!intc->base) {
3aa94590e7bf82 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 89 err = -ENODEV;
3aa94590e7bf82 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 90 goto out_unmap_irq;
3aa94590e7bf82 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 91 }
9869848d12601c arch/mips/jz4740/irq.c Lars-Peter Clausen 2010-07-17 92
1fd224e35c1493 drivers/irqchip/irq-ingenic.c Paul Cercueil 2020-01-13 93 domain = irq_domain_add_linear(node, num_chips * 32,
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 94 &irq_generic_chip_ops, NULL);
52ecc87642f273 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 95 if (!domain) {
52ecc87642f273 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 96 err = -ENOMEM;
52ecc87642f273 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 97 goto out_unmap_base;
52ecc87642f273 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 98 }
52ecc87642f273 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 99
208caadce5d4d3 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 100 intc->domain = domain;
208caadce5d4d3 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 101
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 102 err = irq_alloc_domain_generic_chips(domain, 32, 1, "INTC",
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 103 handle_level_irq, 0,
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 104 IRQ_NOPROBE | IRQ_LEVEL, 0);
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 105 if (err)
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 106 goto out_domain_remove;
42b64f388c171a arch/mips/jz4740/irq.c Thomas Gleixner 2011-03-23 107
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 108 for (i = 0; i < num_chips; i++) {
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 109 gc = irq_get_domain_generic_chip(domain, i * 32);
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 110
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 @111 gc->wake_enabled = IRQ_MSK(32);
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 112 gc->reg_base = intc->base + (i * CHIP_SIZE);
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 113
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 114 ct = gc->chip_types;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 115 ct->regs.enable = JZ_REG_INTC_CLEAR_MASK;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 116 ct->regs.disable = JZ_REG_INTC_SET_MASK;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 117 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 118 ct->chip.irq_mask = irq_gc_mask_disable_reg;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 119 ct->chip.irq_mask_ack = irq_gc_mask_disable_reg;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 120 ct->chip.irq_set_wake = irq_gc_set_wake;
20b44b4de61f28 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 121 ct->chip.flags = IRQCHIP_MASK_ON_SUSPEND;
83bc769200802c arch/mips/jz4740/irq.c Lars-Peter Clausen 2011-09-24 122
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 123 /* Mask all irqs */
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 124 irq_reg_writel(gc, IRQ_MSK(32), JZ_REG_INTC_SET_MASK);
943d69c6c21746 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 125 }
9869848d12601c arch/mips/jz4740/irq.c Lars-Peter Clausen 2010-07-17 126
821fc9e261f3af drivers/irqchip/irq-ingenic.c Paul Cercueil 2020-08-19 127 if (request_irq(parent_irq, intc_cascade, IRQF_NO_SUSPEND,
2ef1cb763d92f3 drivers/irqchip/irq-ingenic.c afzal mohammed 2020-03-04 128 "SoC intc cascade interrupt", NULL))
2ef1cb763d92f3 drivers/irqchip/irq-ingenic.c afzal mohammed 2020-03-04 129 pr_err("Failed to register SoC intc cascade interrupt\n");
adbdce77ccc345 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 130 return 0;
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 131
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 132 out_domain_remove:
8bc7464b514021 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 133 irq_domain_remove(domain);
52ecc87642f273 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 134 out_unmap_base:
52ecc87642f273 drivers/irqchip/irq-ingenic.c Paul Cercueil 2019-10-02 135 iounmap(intc->base);
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 136 out_unmap_irq:
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 137 irq_dispose_mapping(parent_irq);
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 138 out_free:
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 139 kfree(intc);
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 140 out_err:
fe778ece8e2522 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 141 return err;
9869848d12601c arch/mips/jz4740/irq.c Lars-Peter Clausen 2010-07-17 142 }
943d69c6c21746 arch/mips/jz4740/irq.c Paul Burton 2015-05-24 143
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE
2022-02-02 8:44 [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE Christophe Leroy
` (2 preceding siblings ...)
2022-02-02 8:45 ` [PATCH 4/4] [RFC] risc/kasan: " Christophe Leroy
@ 2022-02-02 13:50 ` kernel test robot
3 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-02 13:50 UTC (permalink / raw)
To: Christophe Leroy, Andrey Ryabinin, Alexander Potapenko,
Andrey Konovalov, Dmitry Vyukov, Andrew Morton
Cc: llvm, kbuild-all, Linux Memory Management List, Christophe Leroy,
linux-kernel, linux-hardening, kasan-dev
Hi Christophe,
I love your patch! Yet something to improve:
[auto build test ERROR on tip/sched/core]
[also build test ERROR on linus/master v5.17-rc2]
[cannot apply to hnaz-mm/master next-20220202]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Christophe-Leroy/mm-kasan-Add-CONFIG_KASAN_SOFTWARE/20220202-164612
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git ec2444530612a886b406e2830d7f314d1a07d4bb
config: x86_64-randconfig-a013-20220131 (https://download.01.org/0day-ci/archive/20220202/202202022149.BRH60mXN-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6b1e844b69f15bb7dffaf9365cd2b355d2eb7579)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/29c1001f88c380ea391fa5520f2ddcce35e35681
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christophe-Leroy/mm-kasan-Add-CONFIG_KASAN_SOFTWARE/20220202-164612
git checkout 29c1001f88c380ea391fa5520f2ddcce35e35681
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from arch/x86/boot/compressed/cmdline.c:2:
In file included from arch/x86/boot/compressed/misc.h:32:
In file included from include/linux/acpi.h:14:
In file included from include/linux/resource_ext.h:11:
In file included from include/linux/slab.h:136:
>> include/linux/kasan.h:56:41: error: use of undeclared identifier 'KASAN_SHADOW_SCALE_SHIFT'
return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
^
>> include/linux/kasan.h:57:5: error: use of undeclared identifier 'KASAN_SHADOW_OFFSET'
+ KASAN_SHADOW_OFFSET;
^
2 errors generated.
--
In file included from arch/x86/boot/compressed/pgtable_64.c:2:
In file included from arch/x86/boot/compressed/misc.h:32:
In file included from include/linux/acpi.h:14:
In file included from include/linux/resource_ext.h:11:
In file included from include/linux/slab.h:136:
>> include/linux/kasan.h:56:41: error: use of undeclared identifier 'KASAN_SHADOW_SCALE_SHIFT'
return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
^
>> include/linux/kasan.h:57:5: error: use of undeclared identifier 'KASAN_SHADOW_OFFSET'
+ KASAN_SHADOW_OFFSET;
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:97:11: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds]
return (set->sig[3] | set->sig[2] |
^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
unsigned long sig[_NSIG_WORDS];
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:97:25: warning: array index 2 is past the end of the array (which contains 1 element) [-Warray-bounds]
return (set->sig[3] | set->sig[2] |
^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
unsigned long sig[_NSIG_WORDS];
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:98:4: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
set->sig[1] | set->sig[0]) == 0;
^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
unsigned long sig[_NSIG_WORDS];
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:100:11: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
return (set->sig[1] | set->sig[0]) == 0;
^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
unsigned long sig[_NSIG_WORDS];
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:113:11: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds]
return (set1->sig[3] == set2->sig[3]) &&
^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
unsigned long sig[_NSIG_WORDS];
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:113:27: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds]
return (set1->sig[3] == set2->sig[3]) &&
^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
unsigned long sig[_NSIG_WORDS];
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:114:5: warning: array index 2 is past the end of the array (which contains 1 element) [-Warray-bounds]
(set1->sig[2] == set2->sig[2]) &&
^ ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
unsigned long sig[_NSIG_WORDS];
^
In file included from arch/x86/boot/compressed/pgtable_64.c:3:
In file included from include/linux/efi.h:19:
In file included from include/linux/proc_fs.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
vim +/KASAN_SHADOW_SCALE_SHIFT +56 include/linux/kasan.h
69786cdb379bbc Andrey Ryabinin 2015-08-13 50
9577dd74864877 Andrey Konovalov 2018-12-28 51 int kasan_populate_early_shadow(const void *shadow_start,
69786cdb379bbc Andrey Ryabinin 2015-08-13 52 const void *shadow_end);
69786cdb379bbc Andrey Ryabinin 2015-08-13 53
0b24becc810dc3 Andrey Ryabinin 2015-02-13 54 static inline void *kasan_mem_to_shadow(const void *addr)
0b24becc810dc3 Andrey Ryabinin 2015-02-13 55 {
0b24becc810dc3 Andrey Ryabinin 2015-02-13 @56 return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
0b24becc810dc3 Andrey Ryabinin 2015-02-13 @57 + KASAN_SHADOW_OFFSET;
0b24becc810dc3 Andrey Ryabinin 2015-02-13 58 }
0b24becc810dc3 Andrey Ryabinin 2015-02-13 59
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-02-02 13:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 8:44 [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE Christophe Leroy
2022-02-02 8:44 ` [PATCH 2/4] mm/kasan: Move kasan_pXX_table() and kasan_early_shadow_page_entry() Christophe Leroy
2022-02-02 12:48 ` kernel test robot
2022-02-02 12:49 ` kernel test robot
2022-02-02 8:45 ` [PATCH 3/4] powerpc/ptdump: Use kasan_pXX_table() Christophe Leroy
2022-02-02 8:45 ` [PATCH 4/4] [RFC] risc/kasan: " Christophe Leroy
2022-02-02 13:50 ` [PATCH 1/4] mm/kasan: Add CONFIG_KASAN_SOFTWARE kernel test robot
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).