From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03FE435DA79 for ; Wed, 27 May 2026 18:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907205; cv=none; b=XhJPBfTB0IV3RuNpqUrHqgTmun4+MoIpj3DCaqsy/1QzIB3fR2CAPtRlxS2stIh4cqWAwnog9jw89LM3DObZksqovmsNjpjg86xp2Ir5ID7D4MwnxhpzCz96UhW0Lv2TAR2emJyJigO0UJJ2fyWEUvvHp53o4Lo83J3pMty/8wo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907205; c=relaxed/simple; bh=u5DvR9QwMD4o24JFazRhE7KlpbntTr3t/9/PQa0bfrw=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=icnl9lDx7HxXCT0gEpuxbNM4lqUBPbrzbohktJX+gpD9vCPZ6+HpPZliUIpGOXQQNBNcEZXg/kY/NlK9+wSE9/4iCnoo2q3/d5TsmXfc6FhphJ+0Z0ljvFoJfzFZV/bh7GadqMU+996EzJVfDkb1qLmK3EuQbsrtJUvP3QrDAkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=gDV3jKhs; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="gDV3jKhs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76FA11F000E9; Wed, 27 May 2026 18:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1779907203; bh=unPmmjpLC6bS/AzIxiukCCznD1Q7JDF548Jkv1JjnRY=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=gDV3jKhsJ9CjcGu9TEMsQniaqTLR0LBqKVEKaD2LGc1FjPFLLK+1SVJj9Nffyn7En 51UYqY8oYC11I2GOPJlqn8qOHQ8eBrgrIxiZIpNm6PxZE7pb5R+3eeB6cQ3wYAHMxA yXmDcl2kEFG95QR1oS3RfdfHqiREO1b5ui4C2W3U= Date: Wed, 27 May 2026 11:40:02 -0700 From: Andrew Morton To: Calvin Owens Cc: linux-kernel@vger.kernel.org, Petr Mladek Subject: Re: [PATCH] lib/test_crash: test module to trigger kernel crashes Message-Id: <20260527114002.d71a5a5f8cb4c5b258c3e39f@linux-foundation.org> In-Reply-To: <17c774c9032b5ea214b3ceb0c0a008caf2610e30.1779896981.git.calvin@wbinvd.org> References: <17c774c9032b5ea214b3ceb0c0a008caf2610e30.1779896981.git.calvin@wbinvd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 27 May 2026 09:56:44 -0700 Calvin Owens 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 ;) > --- > 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" > > ... >