public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [bug report] KVM: arm64: Dump instruction on hyp panic
@ 2025-09-18  9:46 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-09-18  9:46 UTC (permalink / raw)
  To: Mostafa Saleh; +Cc: linux-arm-kernel

Hello Mostafa Saleh,

Commit 92b7624fe052 ("KVM: arm64: Dump instruction on hyp panic")
from Sep 9, 2025 (linux-next), leads to the following Smatch static
checker warning:

	arch/arm64/kernel/traps.c:219 die()
	warn: variable dereferenced before check 'regs' (see line 217)

arch/arm64/kernel/traps.c
    206 void die(const char *str, struct pt_regs *regs, long err)
    207 {
    208         int ret;
    209         unsigned long flags;
    210 
    211         raw_spin_lock_irqsave(&die_lock, flags);
    212 
    213         oops_enter();
    214 
    215         console_verbose();
    216         bust_spinlocks(1);
    217         ret = __die(str, err, regs);
                                      ^^^^
Prior to this patch, Smatch used to assume that perhaps a NULL "regs"
would make notify_die() return NOTIFY_STOP so maybe we didn't dereference
it.  But now Smatch knows the dereference is unconditional.

    218 
--> 219         if (regs && kexec_should_crash(current))
                    ^^^^
Checked too late.

    220                 crash_kexec(regs);
    221 
    222         bust_spinlocks(0);
    223         add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
    224         oops_exit();
    225 
    226         if (in_interrupt())
    227                 panic("%s: Fatal exception in interrupt", str);
    228         if (panic_on_oops)
    229                 panic("%s: Fatal exception", str);
    230 
    231         raw_spin_unlock_irqrestore(&die_lock, flags);
    232 
    233         if (ret != NOTIFY_STOP)
    234                 make_task_dead(SIGSEGV);
    235 }

regards,
dan carpenter


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-18  9:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-18  9:46 [bug report] KVM: arm64: Dump instruction on hyp panic Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox