Re: [CRASH] kunit failures in platform-device-devm

From: David Gow

Date: Mon Mar 02 2026 - 19:46:02 EST


Le 02/03/2026 à 11:32 PM, Alice Ryhl a écrit :
On Sun, Mar 01, 2026 at 02:06:49PM +0000, Alice Ryhl wrote:
Hi DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS,

I've experienced a fair number of different crashes when running kunit
locally. I just ran this command on v7.0-rc1 or upstream/master:

./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch x86_64 --kconfig_add CONFIG_RUST=y --kconfig_add CONFIG_PCI=y

Bisection has been carried out!

The culprit is commit 5564c12385b7 ("kthread: Include unbound kthreads
in the managed affinity list"). Cc'ing everyone from this commit.

On this commit, kunit (executed using above command) crashes for me 70%
of the time (14 out of 20 runs) with kernel crashes (Oops) and
refcount_t use-after-free warnings in pm_runtime_test_cases and
platform-device-devm. On the parent commit, I was able to run kunit 24
times in a row with zero kunit failures.

The same crashes occur on tag v7.0-rc2, so this issue is not fixed.


Hmm... I've not been able to reproduce any crashes with stacktraces which look similar to yours, but given the bisection, could this be the kthread exit use-after-free?

Could you try the patch here, and see if that fixes it:
https://lore.kernel.org/all/20260226-ungeziefer-erzfeind-13425179c7b2@brauner/

Cheers,
-- David