Skip to content

Commit 62441a1

Browse files
joergroedelsuryasaimadhu
authored andcommitted
x86/sev-es: Correctly track IRQ states in runtime #VC handler
Call irqentry_nmi_enter()/irqentry_nmi_exit() in the #VC handler to correctly track the IRQ state during its execution. Fixes: 0786138 ("x86/sev-es: Add a Runtime #VC Exception Handler") Reported-by: Andy Lutomirski <[email protected]> Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: [email protected] # v5.10+ Link: https://lkml.kernel.org/r/[email protected]
1 parent 545ac14 commit 62441a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/kernel/sev-es.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,13 +1258,12 @@ static __always_inline bool on_vc_fallback_stack(struct pt_regs *regs)
12581258
DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
12591259
{
12601260
struct sev_es_runtime_data *data = this_cpu_read(runtime_data);
1261+
irqentry_state_t irq_state;
12611262
struct ghcb_state state;
12621263
struct es_em_ctxt ctxt;
12631264
enum es_result result;
12641265
struct ghcb *ghcb;
12651266

1266-
lockdep_assert_irqs_disabled();
1267-
12681267
/*
12691268
* Handle #DB before calling into !noinstr code to avoid recursive #DB.
12701269
*/
@@ -1273,6 +1272,8 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
12731272
return;
12741273
}
12751274

1275+
irq_state = irqentry_nmi_enter(regs);
1276+
lockdep_assert_irqs_disabled();
12761277
instrumentation_begin();
12771278

12781279
/*
@@ -1335,6 +1336,7 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
13351336

13361337
out:
13371338
instrumentation_end();
1339+
irqentry_nmi_exit(regs, irq_state);
13381340

13391341
return;
13401342

0 commit comments

Comments
 (0)