Bug 21343 - [ANCK][6.6][dev]修复riscv架构内核打开kasan配置后编译失败问题
Summary: [ANCK][6.6][dev]修复riscv架构内核打开kasan配置后编译失败问题
Status: NEW
Alias: None
Product: ANCK 6.6 Dev
Classification: ANCK
Component: ARCH(unspecified) (show other bugs) ARCH(unspecified)
Version: unspecified
Hardware: riscv Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: zhangjing
QA Contact: shuming
URL:
Whiteboard:
Keywords: Bugfix
Depends on:
Blocks:
 
Reported: 2025-05-23 14:16 UTC by zhang_anmeng
Modified: 2025-05-27 20:33 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhang_anmeng 2025-05-23 14:16:37 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 zhang_anmeng 2025-05-23 14:32:01 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
编译RISCV架构内核,配置CONFIG_KASAN=y后编译失败


Actual results:
make ARCH=riscv CROSS_COMPILE=~/toolchain/riscv64_gcc14.1/install/bin/riscv64-unknown-linux-gnu-  O=./build/ -j120
make[1]: 进入目录“/home/zam/cloud-kernel/build”
  GEN     Makefile
  CC      arch/riscv/kernel/asm-offsets.s
In file included from ../include/linux/sched/task_stack.h:11,
                 from ../arch/riscv/include/asm/compat.h:12,
                 from ../arch/riscv/include/asm/pgtable.h:119,
                 from ../include/linux/pgtable.h:6,
                 from ../include/linux/mm.h:29,
                 from ../arch/riscv/kernel/asm-offsets.c:8:
../include/linux/kasan.h:53:37: error: 'MAX_PTRS_PER_PTE' undeclared here (not in a function); did you mean 'PTRS_PER_PTE'?
   53 | extern pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE + PTE_HWTABLE_PTRS];
      |                                     ^~~~~~~~~~~~~~~~
      |                                     PTRS_PER_PTE
../include/linux/kasan.h:54:8: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
   54 | extern pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD];
      |        ^~~~~
      |        pgd_t
../include/linux/kasan.h:54:37: error: 'MAX_PTRS_PER_PMD' undeclared here (not in a function); did you mean 'PTRS_PER_PGD'?
   54 | extern pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD];
      |                                     ^~~~~~~~~~~~~~~~
      |                                     PTRS_PER_PGD
../include/linux/kasan.h:55:8: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
   55 | extern pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD];
      |        ^~~~~
      |        pgd_t
../include/linux/kasan.h:55:37: error: 'MAX_PTRS_PER_PUD' undeclared here (not in a function); did you mean 'PTRS_PER_PGD'?
   55 | extern pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD];
      |                                     ^~~~~~~~~~~~~~~~
      |                                     PTRS_PER_PGD
../include/linux/kasan.h:56:8: error: unknown type name 'p4d_t'; did you mean 'pgd_t'?
   56 | extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D];
      |        ^~~~~
      |        pgd_t
../include/linux/kasan.h:56:37: error: 'MAX_PTRS_PER_P4D' undeclared here (not in a function); did you mean 'PTRS_PER_PGD'?
   56 | extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D];
      |                                     ^~~~~~~~~~~~~~~~
      |                                     PTRS_PER_PGD
make[3]: *** [../scripts/Makefile.build:116:arch/riscv/kernel/asm-offsets.s] 错误 1
make[2]: *** [/home/zam/cloud-kernel/Makefile:1209:prepare0] 错误 2
make[1]: *** [/home/zam/cloud-kernel/Makefile:234:__sub-make] 错误 2
make[1]: 离开目录“/home/zam/cloud-kernel/build”
make: *** [Makefile:234:__sub-make] 错误 2

Expected results:


Additional info:
Comment 2 小龙 admin 2025-05-27 20:33:42 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/5361