Re: [PATCH v2 6/9] KVM: arm64: Detect and handle hypervisor stack overflows

kernel test robot
2022-02-23T02:05:19Z

Hi Kalesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cfb92440ee71adcc2105b0890bb01ac3cddb8507]

url: https://github.com/0day-ci/linux/commits/Kalesh-Singh/KVM-arm64-Hypervisor-stack-enhancements/20220223-010522
base: cfb92440ee71adcc2105b0890bb01ac3cddb8507
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20220223/202202230932.BKc5SFqd-lkp@intel.com/config)
compiler: aarch64-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/7fe99fd40f7c4b2973218045ca5b9c9160524db1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kalesh-Singh/KVM-arm64-Hypervisor-stack-enhancements/20220223-010522
git checkout 7fe99fd40f7c4b2973218045ca5b9c9160524db1
# 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=arm64 SHELL=/bin/bash arch/arm64/

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 >>):

arch/arm64/kvm/hyp/nvhe/switch.c:197:43: warning: initialized field overwritten [-Woverride-init]
197 | [ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32,
| ^~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:197:43: note: (near initialization for 'hyp_exit_handlers[3]')
arch/arm64/kvm/hyp/nvhe/switch.c:198:43: warning: initialized field overwritten [-Woverride-init]
198 | [ESR_ELx_EC_SYS64] = kvm_hyp_handle_sysreg,
| ^~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:198:43: note: (near initialization for 'hyp_exit_handlers[24]')
arch/arm64/kvm/hyp/nvhe/switch.c:199:43: warning: initialized field overwritten [-Woverride-init]
199 | [ESR_ELx_EC_SVE] = kvm_hyp_handle_fpsimd,
| ^~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:199:43: note: (near initialization for 'hyp_exit_handlers[25]')
arch/arm64/kvm/hyp/nvhe/switch.c:200:43: warning: initialized field overwritten [-Woverride-init]
200 | [ESR_ELx_EC_FP_ASIMD] = kvm_hyp_handle_fpsimd,
| ^~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:200:43: note: (near initialization for 'hyp_exit_handlers[7]')
arch/arm64/kvm/hyp/nvhe/switch.c:201:43: warning: initialized field overwritten [-Woverride-init]
201 | [ESR_ELx_EC_IABT_LOW] = kvm_hyp_handle_iabt_low,
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:201:43: note: (near initialization for 'hyp_exit_handlers[32]')
arch/arm64/kvm/hyp/nvhe/switch.c:202:43: warning: initialized field overwritten [-Woverride-init]
202 | [ESR_ELx_EC_DABT_LOW] = kvm_hyp_handle_dabt_low,
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:202:43: note: (near initialization for 'hyp_exit_handlers[36]')
arch/arm64/kvm/hyp/nvhe/switch.c:203:43: warning: initialized field overwritten [-Woverride-init]
203 | [ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,
| ^~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:203:43: note: (near initialization for 'hyp_exit_handlers[9]')
arch/arm64/kvm/hyp/nvhe/switch.c:208:43: warning: initialized field overwritten [-Woverride-init]
208 | [ESR_ELx_EC_SYS64] = kvm_handle_pvm_sys64,
| ^~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:208:43: note: (near initialization for 'pvm_exit_handlers[24]')
arch/arm64/kvm/hyp/nvhe/switch.c:209:43: warning: initialized field overwritten [-Woverride-init]
209 | [ESR_ELx_EC_SVE] = kvm_handle_pvm_restricted,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:209:43: note: (near initialization for 'pvm_exit_handlers[25]')
arch/arm64/kvm/hyp/nvhe/switch.c:210:43: warning: initialized field overwritten [-Woverride-init]
210 | [ESR_ELx_EC_FP_ASIMD] = kvm_handle_pvm_fpsimd,
| ^~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:210:43: note: (near initialization for 'pvm_exit_handlers[7]')
arch/arm64/kvm/hyp/nvhe/switch.c:211:43: warning: initialized field overwritten [-Woverride-init]
211 | [ESR_ELx_EC_IABT_LOW] = kvm_hyp_handle_iabt_low,
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:211:43: note: (near initialization for 'pvm_exit_handlers[32]')
arch/arm64/kvm/hyp/nvhe/switch.c:212:43: warning: initialized field overwritten [-Woverride-init]
212 | [ESR_ELx_EC_DABT_LOW] = kvm_hyp_handle_dabt_low,
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:212:43: note: (near initialization for 'pvm_exit_handlers[36]')
arch/arm64/kvm/hyp/nvhe/switch.c:213:43: warning: initialized field overwritten [-Woverride-init]
213 | [ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,
| ^~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:213:43: note: (near initialization for 'pvm_exit_handlers[9]')
arch/arm64/kvm/hyp/nvhe/switch.c:350:17: warning: no previous prototype for 'hyp_panic' [-Wmissing-prototypes]
350 | void __noreturn hyp_panic(void)
| ^~~~~~~~~
>> arch/arm64/kvm/hyp/nvhe/switch.c:372:17: warning: no previous prototype for 'hyp_panic_bad_stack' [-Wmissing-prototypes]
372 | void __noreturn hyp_panic_bad_stack(void)
| ^~~~~~~~~~~~~~~~~~~
arch/arm64/kvm/hyp/nvhe/switch.c:377:17: warning: no previous prototype for 'kvm_unexpected_el2_exception' [-Wmissing-prototypes]
377 | asmlinkage void kvm_unexpected_el2_exception(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/hyp_panic_bad_stack +372 arch/arm64/kvm/hyp/nvhe/switch.c

371
> 372 void __noreturn hyp_panic_bad_stack(void)
373 {
374 hyp_panic();
375 }
376

---
0-DAY CI Kernel Test Service, Intel Corporation