tree:
https://git.kernel.org/pub/scm/linux/kernel/git/joro/linux.git
sev-es-client-v5.8-rc4
head: 7ee5e0ddab7fa6efbf0937f175a5688a375d55b8
commit: 5a65bee572d9fb041b77c5b034f75cc513dc5235 [48/75] x86/sev-es: Add Runtime #VC
Exception Handler
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (
https://github.com/llvm/llvm-project
02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 5a65bee572d9fb041b77c5b034f75cc513dc5235
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> arch/x86/kernel/sev-es.c:484:1: warning: no previous prototype
for function 'safe_stack_exc_vmm_communication' [-Wmissing-prototypes]
DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
^
arch/x86/include/asm/idtentry.h:362:32: note: expanded from macro
'DEFINE_IDTENTRY_VC_SAFE_STACK'
DEFINE_IDTENTRY_RAW_ERRORCODE(safe_stack_##func)
^
<scratch space>:508:1: note: expanded from here
safe_stack_exc_vmm_communication
^
arch/x86/kernel/sev-es.c:484:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
arch/x86/include/asm/idtentry.h:362:2: note: expanded from macro
'DEFINE_IDTENTRY_VC_SAFE_STACK'
DEFINE_IDTENTRY_RAW_ERRORCODE(safe_stack_##func)
^
arch/x86/include/asm/idtentry.h:169:19: note: expanded from macro
'DEFINE_IDTENTRY_RAW_ERRORCODE'
__visible noinstr void func(struct pt_regs *regs, unsigned long error_code)
^
> arch/x86/kernel/sev-es.c:584:1: warning: no previous prototype
for function 'ist_exc_vmm_communication' [-Wmissing-prototypes]
DEFINE_IDTENTRY_VC_IST(exc_vmm_communication)
^
arch/x86/include/asm/idtentry.h:372:32: note: expanded from macro
'DEFINE_IDTENTRY_VC_IST'
DEFINE_IDTENTRY_RAW_ERRORCODE(ist_##func)
^
<scratch space>:23:1: note: expanded from here
ist_exc_vmm_communication
^
arch/x86/kernel/sev-es.c:584:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
arch/x86/include/asm/idtentry.h:372:2: note: expanded from macro
'DEFINE_IDTENTRY_VC_IST'
DEFINE_IDTENTRY_RAW_ERRORCODE(ist_##func)
^
arch/x86/include/asm/idtentry.h:169:19: note: expanded from macro
'DEFINE_IDTENTRY_RAW_ERRORCODE'
__visible noinstr void func(struct pt_regs *regs, unsigned long error_code)
^
2 warnings generated.
vim +/safe_stack_exc_vmm_communication +484 arch/x86/kernel/sev-es.c
483
484 DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
485 {
486 struct sev_es_runtime_data *data = this_cpu_read(runtime_data);
487 struct ghcb_state state;
488 struct es_em_ctxt ctxt;
489 enum es_result result;
490 struct ghcb *ghcb;
491
492 lockdep_assert_irqs_disabled();
493 instrumentation_begin();
494
495 /*
496 * This is invoked through an interrupt gate, so IRQs are disabled. The
497 * code below might walk page-tables for user or kernel addresses, so
498 * keep the IRQs disabled to protect us against concurrent TLB flushes.
499 */
500
501 ghcb = sev_es_get_ghcb(&state);
502 if (!ghcb) {
503 /*
504 * Mark GHCBs inactive so that panic() is able to print the
505 * message.
506 */
507 data->ghcb_active = false;
508 data->backup_ghcb_active = false;
509
510 panic("Unable to handle #VC exception! GHCB and Backup GHCB are already in
use");
511 }
512
513 vc_ghcb_invalidate(ghcb);
514 result = vc_init_em_ctxt(&ctxt, regs, error_code);
515
516 if (result == ES_OK)
517 result = vc_handle_exitcode(&ctxt, ghcb, error_code);
518
519 sev_es_put_ghcb(&state);
520
521 /* Done - now check the result */
522 switch (result) {
523 case ES_OK:
524 vc_finish_insn(&ctxt);
525 break;
526 case ES_UNSUPPORTED:
527 pr_err_ratelimited("Unsupported exit-code 0x%02lx in early #VC exception
(IP: 0x%lx)\n",
528 error_code, regs->ip);
529 goto fail;
530 case ES_VMM_ERROR:
531 pr_err_ratelimited("Failure in communication with VMM (exit-code 0x%02lx IP:
0x%lx)\n",
532 error_code, regs->ip);
533 goto fail;
534 case ES_DECODE_FAILED:
535 pr_err_ratelimited("Failed to decode instruction (exit-code 0x%02lx IP:
0x%lx)\n",
536 error_code, regs->ip);
537 goto fail;
538 case ES_EXCEPTION:
539 vc_forward_exception(&ctxt);
540 break;
541 case ES_RETRY:
542 /* Nothing to do */
543 break;
544 default:
545 pr_emerg("Unknown result in %s():%d\n", __func__, result);
546 /*
547 * Emulating the instruction which caused the #VC exception
548 * failed - can't continue so print debug information
549 */
550 BUG();
551 }
552
553 out:
554 instrumentation_end();
555
556 return;
557
558 fail:
559 if (user_mode(regs)) {
560 /*
561 * Do not kill the machine if user-space triggered the
562 * exception. Send SIGBUS instead and let user-space deal with
563 * it.
564 */
565 force_sig_fault(SIGBUS, BUS_OBJERR, (void __user *)0);
566 } else {
567 pr_emerg("PANIC: Unhandled #VC exception in kernel space
(result=%d)\n",
568 result);
569
570 /* Show some debug info */
571 show_regs(regs);
572
573 /* Ask hypervisor to sev_es_terminate */
574 sev_es_terminate(GHCB_SEV_ES_REASON_GENERAL_REQUEST);
575
576 /* If that fails and we get here - just panic */
577 panic("Returned from Terminate-Request to Hypervisor\n");
578 }
579
580 goto out;
581 }
582
583 /* This handler runs on the #VC fall-back stack. It can cause further #VC
exceptions */
584 DEFINE_IDTENTRY_VC_IST(exc_vmm_communication)
585 {
586 instrumentation_begin();
587 panic("Can't handle #VC exception from unsupported context\n");
588 instrumentation_end();
589 }
590
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org