From: Calvin Owens <calvin@wbinvd.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Petr Mladek <pmladek@suse.com>
Subject: Re: [PATCH] lib/test_crash: test module to trigger kernel crashes
Date: Wed, 27 May 2026 13:44:25 -0700 [thread overview]
Message-ID: <ahdXqS3InSYAY8S6@mozart.vkv.me> (raw)
In-Reply-To: <20260527114002.d71a5a5f8cb4c5b258c3e39f@linux-foundation.org>
On Wednesday 05/27 at 11:40 -0700, Andrew Morton wrote:
> On Wed, 27 May 2026 09:56:44 -0700 Calvin Owens <calvin@wbinvd.org> wrote:
>
> > This test calls panic() from various execution contexts in the kernel,
> > so the user can see if a crash trace is successfully emitted.
> >
> > This is useful for testing console drivers, and can help rule out issues
> > with the console itself when silent reboots or hangs are observed on a
> > particular system.
>
> Well you aren't the first to write a patch which crashes the kernel ;)
Thanks for taking a look Andrew.
In answering some of your questions, I ran across drivers/misc/lkdtm/
which already does all of this and more... oops :/
So we can drop this, unless Petr sees some value to this new one and
wants to chime in.
Thanks,
Calvin
> > ---
> > I shared this upthread in [1] where it turned out to be useful for
> > netconsole. Petr suggested it might be useful for others, so I've
> > applied his feedback and cleaned everything up a bit more too.
> >
> > It's a superset of what 'echo c > /proc/sysrq-trigger' does, but
> > extending that interface doesn't seem practical.
>
> Please fully expand on this?
>
> > The write() implementation requries the entire string be written in a
> > single syscall: this is pretty common for these debugfs interfaces, so
> > it didn't seem worth the complexity to handle partial writes. But I'm
> > happy to do so if somebody cares :)
>
> Some of the above is useful background and deserves to be above the ---
> separator.
>
> I'm not really liking the "crash" name. We already have one of those -
> a kexec crashdumping thing. Maybe "force_panic" or someting.
>
>
> > lib/Kconfig.debug | 18 +++++
> > lib/Makefile | 1 +
> > lib/test_crash.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++
>
> Some Documentation would be nice.
>
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -1385,6 +1385,24 @@ config TEST_LOCKUP
> >
> > If unsure, say N.
> >
> > +config TEST_CRASH
> > + tristate "Test module to trigger crashes"
>
> Some debugfs dependency needed?
>
> > + help
> > + Expose a file in debugfs which triggers a panic() call in
> > + various kernel execution contexts.
> > +
> > + $ cat /sys/kernel/debug/test_crash
> > + irq
> > + [...]
> > + $ echo "irq" > /sys/kernel/debug/test_crash
> > + Kernel panic - not syncing: User triggered crash in context irq
> > +
> > + This is useful for testing console drivers, and can help rule
> > + out issues with the console itself when silent reboots or
> > + hangs are observed on a particular system.
> > +
> > + If unsure, say N.
> > +
> > endmenu # "Debug lockups and hangs"
> >
> > menu "Scheduler Debugging"
> >
> > ...
> >
prev parent reply other threads:[~2026-05-27 20:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 16:56 Calvin Owens
2026-05-27 18:40 ` Andrew Morton
2026-05-27 20:44 ` Calvin Owens [this message]
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=ahdXqS3InSYAY8S6@mozart.vkv.me \
--to=calvin@wbinvd.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.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
all inboxes | Powered by JetHome®