From: Dan Carpenter <dan.carpenter@linaro.org>
To: Mostafa Saleh <smostafa@google.com>
Cc: linux-arm-kernel@lists.infradead.org
Subject: [bug report] KVM: arm64: Dump instruction on hyp panic
Date: Thu, 18 Sep 2025 12:46:31 +0300 [thread overview]
Message-ID: <aMvU9-6DpbTsN3W7@stanley.mountain> (raw)
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
reply other threads:[~2025-09-18 9:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aMvU9-6DpbTsN3W7@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=smostafa@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox