tree: https://github.com/ambarus/linux-0day saravana-fw-devlink-more-forgiving-v2 head: 2c330a32f492512c7e8683ce046c716ecec67681 commit: 56a32b426d272e3ea79af061186f4f81c5958484 [7808/7919] arm64: kasan: export MTE symbols for KASAN tests config: arm64-allyesconfig (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.3.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/ambarus/linux-0day/commit/56a32b426d272e3ea79af061186f4f81c5958484 git remote add ambarus https://github.com/ambarus/linux-0day git fetch --no-tags ambarus saravana-fw-devlink-more-forgiving-v2 git checkout 56a32b426d272e3ea79af061186f4f81c5958484 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): In file included from arch/arm64/include/asm/lse.h:12, from arch/arm64/include/asm/cmpxchg.h:14, from arch/arm64/include/asm/atomic.h:16, from include/linux/atomic.h:7, from include/asm-generic/bitops/atomic.h:5, from arch/arm64/include/asm/bitops.h:26, from include/linux/bitops.h:32, from arch/arm64/kernel/mte.c:6: >> arch/arm64/kernel/mte.c:121:15: error: 'mte_enable_kernel_sync' undeclared here (not in a function); did you mean 'mte_enable_kernel'? 121 | EXPORT_SYMBOL(mte_enable_kernel_sync); | ^~~~~~~~~~~~~~~~~~~~~~ include/linux/export.h:98:16: note: in definition of macro '___EXPORT_SYMBOL' 98 | extern typeof(sym) sym; \ | ^~~ include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL' 155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "") | ^~~~~~~~~~~~~~~ include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL' 158 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "") | ^~~~~~~~~~~~~~ arch/arm64/kernel/mte.c:121:1: note: in expansion of macro 'EXPORT_SYMBOL' 121 | EXPORT_SYMBOL(mte_enable_kernel_sync); | ^~~~~~~~~~~~~ vim +121 arch/arm64/kernel/mte.c > 6 #include <linux/bitops.h> 7 #include <linux/kernel.h> 8 #include <linux/mm.h> 9 #include <linux/prctl.h> 10 #include <linux/sched.h> 11 #include <linux/sched/mm.h> 12 #include <linux/string.h> 13 #include <linux/swap.h> 14 #include <linux/swapops.h> 15 #include <linux/thread_info.h> 16 #include <linux/types.h> 17 #include <linux/uio.h> 18 19 #include <asm/barrier.h> 20 #include <asm/cpufeature.h> 21 #include <asm/mte.h> 22 #include <asm/ptrace.h> 23 #include <asm/sysreg.h> 24 25 u64 gcr_kernel_excl __ro_after_init; 26 27 static bool report_fault_once = true; 28 29 static void mte_sync_page_tags(struct page *page, pte_t *ptep, bool check_swap) 30 { 31 pte_t old_pte = READ_ONCE(*ptep); 32 33 if (check_swap && is_swap_pte(old_pte)) { 34 swp_entry_t entry = pte_to_swp_entry(old_pte); 35 36 if (!non_swap_entry(entry) && mte_restore_tags(entry, page)) 37 return; 38 } 39 40 page_kasan_tag_reset(page); 41 /* 42 * We need smp_wmb() in between setting the flags and clearing the 43 * tags because if another thread reads page->flags and builds a 44 * tagged address out of it, there is an actual dependency to the 45 * memory access, but on the current thread we do not guarantee that 46 * the new page->flags are visible before the tags were updated. 47 */ 48 smp_wmb(); 49 mte_clear_page_tags(page_address(page)); 50 } 51 52 void mte_sync_tags(pte_t *ptep, pte_t pte) 53 { 54 struct page *page = pte_page(pte); 55 long i, nr_pages = compound_nr(page); 56 bool check_swap = nr_pages == 1; 57 58 /* if PG_mte_tagged is set, tags have already been initialised */ 59 for (i = 0; i < nr_pages; i++, page++) { 60 if (!test_and_set_bit(PG_mte_tagged, &page->flags)) 61 mte_sync_page_tags(page, ptep, check_swap); 62 } 63 } 64 65 int memcmp_pages(struct page *page1, struct page *page2) 66 { 67 char *addr1, *addr2; 68 int ret; 69 70 addr1 = page_address(page1); 71 addr2 = page_address(page2); 72 ret = memcmp(addr1, addr2, PAGE_SIZE); 73 74 if (!system_supports_mte() || ret) 75 return ret; 76 77 /* 78 * If the page content is identical but at least one of the pages is 79 * tagged, return non-zero to avoid KSM merging. If only one of the 80 * pages is tagged, set_pte_at() may zero or change the tags of the 81 * other page via mte_sync_tags(). 82 */ 83 if (test_bit(PG_mte_tagged, &page1->flags) || 84 test_bit(PG_mte_tagged, &page2->flags)) 85 return addr1 != addr2; 86 87 return ret; 88 } 89 90 void mte_init_tags(u64 max_tag) 91 { 92 static bool gcr_kernel_excl_initialized; 93 94 if (!gcr_kernel_excl_initialized) { 95 /* 96 * The format of the tags in KASAN is 0xFF and in MTE is 0xF. 97 * This conversion extracts an MTE tag from a KASAN tag. 98 */ 99 u64 incl = GENMASK(FIELD_GET(MTE_TAG_MASK >> MTE_TAG_SHIFT, 100 max_tag), 0); 101 102 gcr_kernel_excl = ~incl & SYS_GCR_EL1_EXCL_MASK; 103 gcr_kernel_excl_initialized = true; 104 } 105 106 /* Enable the kernel exclude mask for random tags generation. */ 107 write_sysreg_s(SYS_GCR_EL1_RRND | gcr_kernel_excl, SYS_GCR_EL1); 108 } 109 110 void mte_enable_kernel(void) 111 { 112 /* Enable MTE Sync Mode for EL1. */ 113 sysreg_clear_set(sctlr_el1, SCTLR_ELx_TCF_MASK, SCTLR_ELx_TCF_SYNC); 114 isb(); 115 } 116 117 void mte_set_report_once(bool state) 118 { 119 WRITE_ONCE(report_fault_once, state); 120 } > 121 EXPORT_SYMBOL(mte_enable_kernel_sync); 122 EXPORT_SYMBOL(mte_set_report_once); 123 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip