[csky-linux:riscv_compat_v2 17/17] arch/riscv/mm/kasan_init.c:20:2: error: call to __compiletime_assert_313 declared with 'error' attribute: BUILD_BUG_ON failed: KASAN_SHADOW_OFFSET != KASAN_SHADOW_END - (1UL << (64 - KASAN_SHADOW_SCALE_SHIFT))

From: kernel test robot
Date: Tue Dec 28 2021 - 17:29:32 EST


tree: https://github.com/c-sky/csky-linux riscv_compat_v2
head: 750f87086bdd630f80b9bc3581bc3f329ef20f53
commit: 750f87086bdd630f80b9bc3581bc3f329ef20f53 [17/17] riscv: compat: Add COMPAT Kbuild skeletal support
config: riscv-buildonly-randconfig-r005-20211228 (https://download.01.org/0day-ci/archive/20211229/202112290641.BEJik8MB-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 7171af744543433ac75b232eb7dfdaef7efd4d7a)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/c-sky/csky-linux/commit/750f87086bdd630f80b9bc3581bc3f329ef20f53
git remote add csky-linux https://github.com/c-sky/csky-linux
git fetch --no-tags csky-linux riscv_compat_v2
git checkout 750f87086bdd630f80b9bc3581bc3f329ef20f53
# 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=riscv SHELL=/bin/bash arch/riscv/mm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> arch/riscv/mm/kasan_init.c:20:2: error: call to __compiletime_assert_313 declared with 'error' attribute: BUILD_BUG_ON failed: KASAN_SHADOW_OFFSET != KASAN_SHADOW_END - (1UL << (64 - KASAN_SHADOW_SCALE_SHIFT))
BUILD_BUG_ON(KASAN_SHADOW_OFFSET !=
^
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:335:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:323:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:316:4: note: expanded from macro '__compiletime_assert'
prefix ## suffix(); \
^
<scratch space>:7:1: note: expanded from here
__compiletime_assert_313
^
1 error generated.


vim +/error +20 arch/riscv/mm/kasan_init.c

e178d670f251b6 Nylon Chen 2021-01-16 13
8ad8b72721d0f0 Nick Hu 2020-01-06 14 extern pgd_t early_pg_dir[PTRS_PER_PGD];
8ad8b72721d0f0 Nick Hu 2020-01-06 15 asmlinkage void __init kasan_early_init(void)
8ad8b72721d0f0 Nick Hu 2020-01-06 16 {
8ad8b72721d0f0 Nick Hu 2020-01-06 17 uintptr_t i;
8ad8b72721d0f0 Nick Hu 2020-01-06 18 pgd_t *pgd = early_pg_dir + pgd_index(KASAN_SHADOW_START);
8ad8b72721d0f0 Nick Hu 2020-01-06 19
54c5639d8f507e Alexandre Ghiti 2021-10-29 @20 BUILD_BUG_ON(KASAN_SHADOW_OFFSET !=
54c5639d8f507e Alexandre Ghiti 2021-10-29 21 KASAN_SHADOW_END - (1UL << (64 - KASAN_SHADOW_SCALE_SHIFT)));
54c5639d8f507e Alexandre Ghiti 2021-10-29 22
8ad8b72721d0f0 Nick Hu 2020-01-06 23 for (i = 0; i < PTRS_PER_PTE; ++i)
8ad8b72721d0f0 Nick Hu 2020-01-06 24 set_pte(kasan_early_shadow_pte + i,
8ad8b72721d0f0 Nick Hu 2020-01-06 25 mk_pte(virt_to_page(kasan_early_shadow_page),
8ad8b72721d0f0 Nick Hu 2020-01-06 26 PAGE_KERNEL));
8ad8b72721d0f0 Nick Hu 2020-01-06 27
8ad8b72721d0f0 Nick Hu 2020-01-06 28 for (i = 0; i < PTRS_PER_PMD; ++i)
8ad8b72721d0f0 Nick Hu 2020-01-06 29 set_pmd(kasan_early_shadow_pmd + i,
8458ca147c204e Zong Li 2020-02-07 30 pfn_pmd(PFN_DOWN
8458ca147c204e Zong Li 2020-02-07 31 (__pa((uintptr_t) kasan_early_shadow_pte)),
8ad8b72721d0f0 Nick Hu 2020-01-06 32 __pgprot(_PAGE_TABLE)));
8ad8b72721d0f0 Nick Hu 2020-01-06 33
8ad8b72721d0f0 Nick Hu 2020-01-06 34 for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END;
8ad8b72721d0f0 Nick Hu 2020-01-06 35 i += PGDIR_SIZE, ++pgd)
8ad8b72721d0f0 Nick Hu 2020-01-06 36 set_pgd(pgd,
8458ca147c204e Zong Li 2020-02-07 37 pfn_pgd(PFN_DOWN
8458ca147c204e Zong Li 2020-02-07 38 (__pa(((uintptr_t) kasan_early_shadow_pmd))),
8ad8b72721d0f0 Nick Hu 2020-01-06 39 __pgprot(_PAGE_TABLE)));
8ad8b72721d0f0 Nick Hu 2020-01-06 40
8ad8b72721d0f0 Nick Hu 2020-01-06 41 /* init for swapper_pg_dir */
8ad8b72721d0f0 Nick Hu 2020-01-06 42 pgd = pgd_offset_k(KASAN_SHADOW_START);
8ad8b72721d0f0 Nick Hu 2020-01-06 43
8ad8b72721d0f0 Nick Hu 2020-01-06 44 for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END;
8ad8b72721d0f0 Nick Hu 2020-01-06 45 i += PGDIR_SIZE, ++pgd)
8ad8b72721d0f0 Nick Hu 2020-01-06 46 set_pgd(pgd,
8458ca147c204e Zong Li 2020-02-07 47 pfn_pgd(PFN_DOWN
8458ca147c204e Zong Li 2020-02-07 48 (__pa(((uintptr_t) kasan_early_shadow_pmd))),
8ad8b72721d0f0 Nick Hu 2020-01-06 49 __pgprot(_PAGE_TABLE)));
8ad8b72721d0f0 Nick Hu 2020-01-06 50
4cb699d0447be8 Vincent Chen 2020-07-10 51 local_flush_tlb_all();
8ad8b72721d0f0 Nick Hu 2020-01-06 52 }
8ad8b72721d0f0 Nick Hu 2020-01-06 53

:::::: The code at line 20 was first introduced by commit
:::::: 54c5639d8f507ebefa814f574cb6f763033a72a5 riscv: Fix asan-stack clang build

:::::: TO: Alexandre Ghiti <alexandre.ghiti@xxxxxxxxxxxxx>
:::::: CC: Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx