Skip to content

Leave the racy ratelimit KUnit test out of the initramfs - #90

Merged
tamnd merged 2 commits into
mainfrom
leave-out-racy-ratelimit-test
Oct 13, 2026
Merged

tamnd merged 2 commits into
mainfrom
leave-out-racy-ratelimit-test

Conversation

@tamnd

@tamnd tamnd commented Oct 13, 2026

Copy link
Copy Markdown
Owner

A KUnit run of 7.2.8 X64 on server2 had three splats only in the rucc kernel log:

  • refcount_t: addition on 0; use-after-free in kthread_stop, called from test_ratelimit_stress
  • refcount_t: underflow; use-after-free at the same place
  • the warning in __put_task_struct that follows from the two above

The cause is the test and not the compiler. test_ratelimit_stress sets doneflag, which its threads stop on, and then calls kthread_stop on each thread. A thread that sees the flag and exits before kthread_stop gets to it frees its task, so kthread_stop takes a reference on a freed task. The reference kernel can hit the same race, and it depends only on how the vCPUs are scheduled. Upstream fixes the test by making the threads wait for kthread_should_stop() (Jia He, "lib/tests: test_ratelimit: fix stress test thread lifecycle and leak", v3 on LKML in May 2026).

The fragment cannot turn the test off, because KUNIT_ALL_TESTS=m hides the prompt of RATELIMIT_KUNIT_TEST. This change makes rk test leave lib/tests/test_ratelimit.ko out of the initramfs for both kernels, as it already turns off KUNIT_FAULT_TEST for both. The module only exists in 7.2.x.

Tested on server2 with cargo test -p rk testrun, cargo fmt --check and cargo clippy.

@tamnd tamnd added kind/bug Something in the harness is wrong area/rk The rk command line row/x64 x86-64 labels Oct 13, 2026
@tamnd
tamnd merged commit 950d37b into main Oct 13, 2026
2 checks passed
@tamnd
tamnd deleted the leave-out-racy-ratelimit-test branch October 13, 2026 07:36
@tamnd tamnd mentioned this pull request Oct 13, 2026
7 of 13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/rk The rk command line kind/bug Something in the harness is wrong row/x64 x86-64

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant