Undoing ext4's fixes, one at a time: which tests notice?
The idea, for anyone: when someone fixes a bug and adds a test, that test should fail if you undo the fix. If it still passes, it is not guarding that fix. So I took the 48 bug fixes in one big Linux pull, undid each one, and ran the tests.
What came back: 41 of the 48 could be undone on their own. For 6 of those, some test failed (the test is doing its job). For 1, the test kernel crashed part way through, which is also the tests noticing. For 34, every test still passed. 7 could not be undone alone, because later fixes changed the same lines.
The interesting one: a fix whose test claims to cover it, yet the test passed with the fix removed. It looked like a missing test. It was not: a later fix in the same pull prevents the same damage. Undo both, and the test fails at the exact line I predicted, in writing, before the run.
dev commit
97f29574e12e,
dated 19:13 UTC on 2026-11-25, two and a half hours before my first run) and a crash of the new tests when the kernel is
built with CONFIG_USER_NS=y
(ad592b92d677).
Nothing here is a new bug report. The kernel code was right in both cases; what was missing was a test stub and a field
in a test's fake superblock.
Words used on this page
- ext4
- A Linux filesystem, the default on many distributions: the code that lays files out on a disk.
- KUnit
- The Linux kernel's built-in unit test framework. Each test calls a small piece of kernel code directly and checks the answer, with no real disk. EXTERNAL · official docs ↗
- kunit.py
- KUnit's runner: it builds a test kernel, boots it, and reports each test as passed or failed. EXTERNAL · official docs ↗
- UML (User Mode Linux)
- The kernel built as an ordinary program, so the tests run on a laptop without a virtual machine. Every run here is 64-bit x86 UML.
- A
Fixes:tag - The line in a kernel commit message that names the commit whose bug it fixes. EXTERNAL · official docs ↗
- Undoing (reverting) a fix
- Here, always: at the pull's last commit, reverse the fix's changes outside the
test files (
fs/ext4/*-test.c) and keep the tests as they are. A plaingit revertwould also delete a test that arrived in the same commit as its fix. - Witnessed
- Some test fails with the fix undone and passes with it in place. That test is a witness for the fix.
- Passes both ways
- Every test passes with the fix undone too. This does not mean the fix is untested: ext4's main regression suite is xfstests, which tests a real mounted filesystem and was not run here (EXTERNAL · project docs ↗). It means the KUnit tests did not catch that fix being undone, under this one configuration.
- KASAN
- The kernel's memory-error detector, a build option that turns an out-of-bounds access or a use after free into a report. EXTERNAL · official docs ↗
- jbd2
- The journaling layer ext4 sits on, in
fs/jbd2/, a separate directory fromfs/ext4/. - Kernel configuration
- The list of options a kernel is built with.
CONFIG_USER_NSturns on user namespaces (separate user id ranges, the thing containers use); kunit.py's--kconfig_addadds an option on top of the suite's own list,fs/ext4/.kunitconfig.
Why this pull
On 2026-11-24 Ted sent the ext4 pull for 7.4-rc5 (base 7475ea8b5861, which is v7.4-rc2, tip
bae28a1b11f4, 94 commits, 41,197 added lines). Most of the new lines are KUnit tests; his message says they
make it "safer to validate AI generated patches"
(EXTERNAL · mailing list ↗). Linus merged it
as 4dce97c6c265
and, replying to Ted, wrote that the test conflict resolutions looked right to him "but I didn't *run* any of them"
(EXTERNAL · mailing list ↗).
That raises a question you can answer with a computer: do the new tests notice when the fixes they ship with are taken away?
1. The merge, under two kernel configurations
The whole ext4 KUnit suite (562 tests), run with
kunit.py run --arch=um --kunitconfig=fs/ext4, with and without CONFIG_USER_NS=y added.
| Tree | The suite's own config (CONFIG_USER_NS off) | Plus CONFIG_USER_NS=y |
|---|---|---|
The pull's tip bae28a1b11f4 | 562 of 562 pass | 277 pass, then the kernel panics in the new xattr test; the other 285 never run |
Linus's merge 4dce97c6c265 | 560 pass, 2 fail (the same 2 in each of three runs) | 275 pass, the same 2 fail, then the same panic |
Ted's ext4 dev tip ad592b92d677 (the merge plus his two fixes) | 562 of 562 pass | 562 of 562 pass |
The 2 failures at the merge are ext4_inode_test.inode_test_get_inode_loc_variants and
ext4_inode_test.inode_test_write_and_sync_metadata. Linus's side of the merge had switched
ext4_get_inode_loc_noio() to a non-atomic block lookup (d25c14b2d79e), and the merge kept that
through a new wrapper, ext4_sb_find_get_block_nonatomic(). The pull's test replaces only the old lookup,
ext4_sb_find_get_block(), with its fake buffer cache, so the fake is never asked and the function returns
"try again" (-EAGAIN). Putting that one call back to the old lookup makes all 41 inode tests pass, which
located the cause; Ted's actual fix adds the missing stub to the test instead (2 lines in
fs/ext4/inode-test.c), which is the right fix: the code was correct.
# inode_test_get_inode_loc_variants: ASSERTION FAILED at fs/ext4/inode-test.c:1846
Expected err == 0, but
err == -11 (0xfffffffffffffff5)
# inode_test_write_and_sync_metadata: EXPECTATION FAILED at fs/ext4/inode-test.c:3335
Expected err == -5, but
err == 0 (0x0)
The panic with CONFIG_USER_NS=y is the one Ted's second fix describes: the xattr test's
fake superblock has no user namespace, and creating an extended-attribute inode reads the owner through it. On UML a
fault in kernel code with no memory map stops the whole kernel, not one test:
RIP: 0033:map_id_range_up+0xa/0xd0
Kernel panic - not syncing: Segfault with no mm
[<602aa9b5>] ? ext4_xattr_inode_lookup_create+0x375/0xbd0
[<602ad589>] ? ext4_xattr_set+0x99/0x180
[<602f65b7>] ? test_xattr_external_block_and_check+0x677/0x10e0
Every run before this check used the suite's own configuration, so every count below holds for that configuration:
fs/ext4/.kunitconfig does not set CONFIG_USER_NS and the kernel's default is off. The
configuration check's outcome for each tree (fails or passes) was written down and committed before it ran
(prediction, cases;
committed 01:10 UTC on 2026-11-26, first job 01:17 UTC); each came out as written.
Raw results: merge log,
tip log,
the repeat and the one-line check,
the tip's kernel log with CONFIG_USER_NS=y, and
every case's result, kunit.py output, kernel log and generated .config in
results/config/.
2. Undoing each of the 48 fixes
The pull has 50 commits with a Fixes: line; one touches only test files and one changes only a comment,
which leaves 48 that change code. For each, at the tip:
git diff FIX^ FIX -- . ':!fs/ext4/*-test.c' | git apply -R --3way
python3 tools/testing/kunit/kunit.py run --arch=um --kunitconfig=fs/ext4
- witnessed (6)
- stopped part way (1)
- passes both ways (34)
- reversal conflicts (7)
- 41 undid cleanly. 6 made some test fail. 1 (
f62b22b69aef) made the kernel panic part way through the suite (342 tests pass, 220 are never reached). 34 left all 562 passing. - 7 could not be undone alone: a later commit of the same pull changed the same lines, so "the tip without this one fix" is not a well-defined tree.
- Two of the 6 were caught by tests that name no bug:
daa099ec5ce3(orphan file size check) andff06f373c1d7(journal recovery on an incomplete fast commit) were caught by the pull's general coverage tests. The other 4 are caught by a test that says it covers them. - What the 34 are. Of the 34, only one (
337c173f966c, next section) is a fix a test in the pull claims to cover. 6 are jbd2 fixes, outsidefs/ext4/entirely, andc966757ff80fis a bug in 32-bit kernels, which a 64-bit build cannot show. Five are memory-safety fixes, the most likely to hide from a build without KASAN, so they were rerun on a laptop withCONFIG_KASAN=y: the tip and each of the five undone still pass 562 of 562 with no KASAN report (KASAN summary).
Every job took about 7 seconds (an incremental rebuild plus the whole suite) on a 16-CPU cloud sandbox. The tool's verdicts are derived from each job's raw result file, which lists every test's status with and without the fix: all 48 result files and this table as JSON. One correction to the tool, made after this run: it labeled the crash "cannot run", the same words as a conflict; it now reports such a job as stopped part way, and the table says what happened.
| Fix | Title | Outcome | Why, or which tests |
|---|---|---|---|
3b6aee59883c | ext4: clear journal restart indication after inserting extent | witnessed | 1 test fails without the fix and passes with it: ext4_migrate_test.test_ext_migrate_survives_handle_restart A test claims it: bae28a1b11f4's migration tests. |
9627baed418b | ext4: check multi-block overlap on left traversal in add_system_zone() | witnessed | 4 tests fail without the fix and pass with it: ext4_block_validity_test.test_journal_extent_left_overlap_rejected, ext4_block_validity_test.test_setup_corrupt_group_metadata_overlaps.itable_starts_before_and_encloses_ibitmap, ext4_block_validity_test.test_setup_corrupt_group_metadata_overlaps.itable_starts_before_and_overlaps_bbitmap, ext4_block_validity_test.test_setup_corrupt_group_metadata_overlaps.itable_u64_wrap_around_overflow A test claims it: its own test, in the same commit. |
b0a3f2c102e8 | ext4: cap migration extent length at EXT_INIT_MAX_LEN | witnessed | 1 test fails without the fix and passes with it: ext4_migrate_test.test_ext_migrate_caps_long_run_at_init_max_len A test claims it: bae28a1b11f4's migration tests. |
bfb8f5ce8815 | ext4: drop tmp inode ownership before migration cleanup | witnessed | 1 test fails without the fix and passes with it: ext4_migrate_test.test_ext_migrate_credit_or_dirty_failure_keeps_live_blocks A test claims it: bae28a1b11f4's migration tests. |
daa099ec5ce3 | ext4: Fix maximum orphan file size check | witnessed | 1 test fails without the fix and passes with it: ext4_orphan_test.test_init_orphan_info_max_blocks_boundary |
ff06f373c1d7 | ext4: don't fail journal recovery on an incomplete fast commit | witnessed | 1 test fails without the fix and passes with it: ext4_fast_commit_test.test_fc_replay_regions_and_scan |
f62b22b69aef | ext4: free fast commit replay state on failed mounts | stopped part way | without the fix the kernel panics part way through the suite, in ext4_fast_commit_test: 342 tests pass and 220 are never reached (the laptop rerun's log shows the panic: BUG at fs/ext4/ext4_jbd2.c:36). The tool that ran this job labeled it "cannot run"; it was fixed afterwards to say stopped part way |
0a10fca0f154 | ext4: fix folio reference leak in mpage_submit_partial_folio() | passes both ways | all 562 tests pass with the fix reverted and at the tip; a memory-safety fix: rerun with KASAN on a laptop, still 562 of 562 and no KASAN report |
0bc15784860e | jbd2: fix shrinker scan budget accounting in jbd2_journal_shrink_scan() | passes both ways | all 562 tests pass with the fix reverted and at the tip; a jbd2 fix (fs/jbd2/ only, the journaling layer under ext4) |
180354ab292f | ext4: drop extra ea_inode ref in cached-block reuse path | passes both ways | all 562 tests pass with the fix reverted and at the tip; a memory-safety fix: rerun with KASAN on a laptop, still 562 of 562 and no KASAN report |
1ea9e6b3bd31 | ext4: return 0 instead of stale ret in ext4_iomap_writepages() | passes both ways | all 562 tests pass with the fix reverted and at the tip |
2c1c8c412bb8 | ext4: propagate errors from fast commit bitmap rebuild | passes both ways | all 562 tests pass with the fix reverted and at the tip |
2cfcd9fa8734 | ext4: return an error when a journal block is not mapped | passes both ways | all 562 tests pass with the fix reverted and at the tip |
337c173f966c | ext4: don't free the tmp_inode tree after a partial migration swap | passes both ways | all 562 tests pass with the fix reverted and at the tip; masked by the later fix 6bda1a98b7ce: see the masking check A test claims it: bae28a1b11f4's migration tests (cited there by its pre-rebase hash 047061e6a6da). |
356c92606175 | ext4: clear in-inode xattr space before adding the first xattr | passes both ways | all 562 tests pass with the fix reverted and at the tip |
390d69dd5c82 | ext4: add inode to orphan list before extent conversion | passes both ways | all 562 tests pass with the fix reverted and at the tip |
3b9f870a7549 | ext4: add bounds check for e_value_offs in ext4_read_inline_data | passes both ways | all 562 tests pass with the fix reverted and at the tip; a memory-safety fix: rerun with KASAN on a laptop, still 562 of 562 and no KASAN report |
40b2a37f9a7e | jbd2: check return value of blkdev_issue_flush() when checkpointing | passes both ways | all 562 tests pass with the fix reverted and at the tip; a jbd2 fix (fs/jbd2/ only, the journaling layer under ext4) |
40e53dad45a9 | jbd2: set JBD2_LOADED under j_state_lock | passes both ways | all 562 tests pass with the fix reverted and at the tip; a jbd2 fix (fs/jbd2/ only, the journaling layer under ext4) |
44d3b834bef8 | ext4: skip holes when shrinking the extent tree in fast commit replay | passes both ways | all 562 tests pass with the fix reverted and at the tip |
474b6405c0f6 | ext4: do not accept rec_len 0 for block sizes below 64k | passes both ways | all 562 tests pass with the fix reverted and at the tip |
489b444770b1 | ext4: propagate errors from fast commit create replay | passes both ways | all 562 tests pass with the fix reverted and at the tip |
4a5cc4d1a7f0 | ext4: propagate errors from fast commit block cleanup | passes both ways | all 562 tests pass with the fix reverted and at the tip |
4e04e3962070 | ext4: fix the logical block counter overflow in indirect migration | passes both ways | all 562 tests pass with the fix reverted and at the tip |
543341eba8f4 | jbd2: don't start a fast commit while the journal is marked empty | passes both ways | all 562 tests pass with the fix reverted and at the tip; a jbd2 fix (fs/jbd2/ only, the journaling layer under ext4) |
58b186b5bbd2 | ext4: validate inode block references during fast commit replay | passes both ways | all 562 tests pass with the fix reverted and at the tip |
7d7c94601664 | ext4: fix discard work use-after-free on failed mount | passes both ways | all 562 tests pass with the fix reverted and at the tip; a memory-safety fix: rerun with KASAN on a laptop, still 562 of 562 and no KASAN report |
7d7c9c83c822 | ext4: complete dropbehind writeback in task context | passes both ways | all 562 tests pass with the fix reverted and at the tip |
8d90b9ab0875 | ext4: save converted extent before merging | passes both ways | all 562 tests pass with the fix reverted and at the tip |
8eb922c5c467 | ext4: record writeback error when discarding pages on failed delalloc | passes both ways | all 562 tests pass with the fix reverted and at the tip |
9e3cb03d3933 | jbd2: check return value of blkdev_issue_flush() for async commits | passes both ways | all 562 tests pass with the fix reverted and at the tip; a jbd2 fix (fs/jbd2/ only, the journaling layer under ext4) |
b28443aa879b | ext4: propagate errors from fast commit i_blocks replay | passes both ways | all 562 tests pass with the fix reverted and at the tip |
b8e62a68c59f | jbd2: check return value of blkdev_issue_flush() when committing | passes both ways | all 562 tests pass with the fix reverted and at the tip; a jbd2 fix (fs/jbd2/ only, the journaling layer under ext4) |
bbae5e26222e | ext4: do not report inline conversion allocation failures as fs errors | passes both ways | all 562 tests pass with the fix reverted and at the tip |
c966757ff80f | ext4: fix readdir position truncation on 32-bit kernels | passes both ways | all 562 tests pass with the fix reverted and at the tip; a 32-bit-only bug, which a 64-bit build cannot show |
cdecc68d94a7 | ext4: preserve force-fsck requests across unmount | passes both ways | all 562 tests pass with the fix reverted and at the tip |
d0877f8eb3c0 | ext4: initialize map->m_pblk in ext4_da_map_blocks() | passes both ways | all 562 tests pass with the fix reverted and at the tip |
d5fd7d0564d8 | ext4: fix extent status cache clearing when truncating inline data | passes both ways | all 562 tests pass with the fix reverted and at the tip |
e290c77088e6 | ext4: fix OOB memmove in ext4_xattr_set_entry | passes both ways | all 562 tests pass with the fix reverted and at the tip; a memory-safety fix: rerun with KASAN on a laptop, still 562 of 562 and no KASAN report |
e5db68ec43e9 | ext4: do not advance i_size on a buffered write that copied nothing | passes both ways | all 562 tests pass with the fix reverted and at the tip |
f0872c44eda1 | ext4: skip eof zeroing when the zero range covers the eof block | passes both ways | all 562 tests pass with the fix reverted and at the tip |
020035ee8fea | ext4: fix shrinker scan budget accounting in ext4_es_scan() | reversal conflicts | the reverse of its changes does not apply at the tip: a later commit of the pull changed the same lines (git reports a conflict in fs/ext4/extents_status.c) |
6025f9d156cf | ext4: check return value of blkdev_issue_flush() when starting a fast commit | reversal conflicts | the reverse of its changes does not apply at the tip: a later commit of the pull changed the same lines (git reports a conflict in fs/ext4/fast_commit.c) |
79906e00636e | ext4: don't cache unzeroed blocks as written after a failed zeroout | reversal conflicts | the reverse of its changes does not apply at the tip: a later commit of the pull changed the same lines (git reports a conflict in fs/ext4/extents.c) |
82e2a5743b6a | ext4: don't clobber the migration error in ext4_ext_migrate() | reversal conflicts | the reverse of its changes does not apply at the tip: a later commit of the pull changed the same lines (git reports a conflict in fs/ext4/migrate.c) A test claims it: bae28a1b11f4's migration tests. |
8a72b083d8bc | ext4: check return value of blkdev_issue_flush() when initializing inode tables | reversal conflicts | the reverse of its changes does not apply at the tip: a later commit of the pull changed the same lines (git reports a conflict in fs/ext4/ialloc.c) |
a7fd013d368a | ext4: reject atomic writes on inodes that can't do direct I/O | reversal conflicts | the reverse of its changes does not apply at the tip: a later commit of the pull changed the same lines (git reports a conflict in fs/ext4/ext4.h) |
cd169c27f0ab | ext4: track zeroed out blocks of unwritten extents for fast commit | reversal conflicts | the reverse of its changes does not apply at the tip: a later commit of the pull changed the same lines (git reports a conflict in fs/ext4/ext4.h, fs/ext4/ext4_extents.h) |
3. Masked, not missing: 337c173f
The pull's last commit, bae28a1b11f4, adds migration tests and says in its message that they cover
several fixes, among them "ext4: don't free the tmp_inode tree after a partial migration swap". That is
337c173f966c; the message cites it by its pre-rebase hash, 047061e6a6da, so searching the
message for 337c173f finds nothing. Undo it, and all 11 migration tests still pass.
Reading the code first, without running anything: the test does check the outcome that fix protects. Line 1351 of
fs/ext4/migrate-test.c,
KUNIT_EXPECT_FALSE(test, migrate_was_freed(ctx, ext_idx_pblk)), asks whether the migrated inode's extent
index block was freed after a failed swap, which is the bug in 337c173f's own message. But a later fix in the same pull,
6bda1a98b7ce (another author's; it carries no Fixes: line, so it is not one of the 48), empties
the temporary inode's extent tree before anything can fail. With it in place, the call 337c173f skips frees nothing
anyway. A belt where the braces are already on.
So the guess was masked: line 1351 should fail only when both are undone. The other guess, that no test reaches this bug, says line 1351 never fails. I wrote down, for each of five cases, which way line 1351 would go, and committed that before the run (prediction, cases; committed 23:02 UTC on 2026-11-25, first job 23:07 UTC, per the run's own log). Those commit times are from my private repository, so for the order you have my word, not a public timestamp; the laptop rerun below reproduces the outcome either way.
| Undone at the tip | Predicted at line 1351 | Line 1351 | Expectations that failed |
|---|---|---|---|
| nothing (the tip) | holds | holds | none; 11 of 11, and the whole suite 562 of 562 |
| 337c173f alone | holds | holds | none |
| 6bda1a98 alone | holds | holds | 1327, 1328 |
| bfb8f5ce alone | holds | holds | 1325, 1329 |
| 337c173f and 6bda1a98 | fails | fails | 1327, 1328, 1351 |
| 337c173f and bfb8f5ce | holds | holds | 1325, 1329 |
# test_ext_migrate_credit_or_dirty_failure_keeps_live_blocks: EXPECTATION FAILED at fs/ext4/migrate-test.c:1351
Expected migrate_was_freed(ctx, ext_idx_pblk) to be false, but is true
(that run's log; every case's result and
log are in results/masking/.) The pull's claim holds in the sense that matters:
the test checks what 337c173f protects. What no test at the tip can do is fail for 337c173f's absence alone, because
6bda1a98 makes it redundant there. Not run, so a reading only: on a tree that takes 337c173f without 6bda1a98 (a stable
backport picked one at a time, say; both carry Cc: stable), 337c173f alone would decide line 1351.
The general lesson for anyone checking tests this way: "passes both ways" can mean a later fix is doing the same job. Undoing fixes that touch the same code in pairs, and watching the one line that names the bug, told the two apart in one run.
4. Rerun it on your laptop
You need Docker, Python 3 and about 3 GB of disk. The first run fetches the kernel history since 2026-11-01
from GitHub (633 MB) and two commits of Ted's tree from git.kernel.org, and builds the test kernel; later runs reuse
both. On my laptop the first masking run, fetch and build included, took about 4 minutes.
curl -sLO https://plimsollmark.github.io/plimsoll/case-studies/ext4-witness/scripts/reproduce.sh
for f in setup.sh witness.py queues.py fixes.json; do
curl -sLO https://plimsollmark.github.io/plimsoll/case-studies/ext4-witness/scripts/$f
done
sh reproduce.sh masking # section 3: six jobs
sh reproduce.sh merge # section 1, the suite's own config
sh reproduce.sh config # section 1, both configs and Ted's dev tip
sh reproduce.sh fixes # section 2: all 48
Each prints one line per job and leaves every result file and kunit.py log in ext4-witness-out/.
These exact scripts were run that way before this page went up (sh reproduce.sh masking, on a laptop,
2026-11-26): line 1351 failed only with 337c173f and 6bda1a98 both undone, every other failed expectation matched the
table in section 3, and the tip passed 562 of 562
(its summary,
its result files).
- witness.py: the program that runs each job (undo the fixes, run the suite, compare every test). Standard library Python only.
- queues.py: the job lists for each section, every commit spelled out; fixes.json: the 48 fixes with titles and files.
- setup.sh: the build tools and the two public fetches, inside the container.
- reproduce.sh: runs the above in a Debian container pinned by digest.
The runs on this page were made in a 16-CPU cloud sandbox, driven by a small script of mine that creates the
sandbox, copies witness.py and a queue in, and copies the results out. That script is specific to the cloud
service and its billing and is left out; nothing in it changes a result. witness.py here is the version
that ran last, changed only so its paths can be moved and ccache is optional.
Already rerun once, on a different machine. A second check, written separately from
witness.py (its own undo and run commands), ran on a laptop: Debian bookworm's gcc 12, no ccache, a fresh
clone. The tip passed 562 of 562 three times; the same 6 fixes were caught by the same tests; f62b22b69aef
stopped at the same 342 with BUG: failure at fs/ext4/ext4_jbd2.c:36; 82e2a5743b6a
conflicted the same way; undoing 6bda1a98 and 337c173f together failed lines 1327, 1328 and 1351 and nothing else. After
the first build each run took 4 to 6 seconds; the whole rerun took under two minutes
(summary,
test-for-test comparison,
every log,
its .config).
What this shows, and what it does not
- Shows: under UML, 64-bit, the suite's own configuration, which of the pull's 48 fixes the ext4 KUnit tests notice being undone, one at a time, with the test files kept. And that the one apparent miss among the fixes a test claims is a fix made redundant by a later one.
- Does not show: that the 34 are untested (xfstests was not run, and most of them never claimed a KUnit test); anything about other configurations (KASAN only for five fixes; no lockdep, no QEMU, no other architecture); anything about the 7 that conflict; that the fixes are correct; or that tests like these validate AI-written patches in general.
- About run records. I build plimsoll (INTERNAL · plimsoll site →), a sandbox for untrusted code that returns a run record with each run: SHA-256 digests binding the request and result bytes to the daemon's account of the run (EXTERNAL · source repo ↗; even there a record is the daemon's statement, never proof of what a machine actually ran). The runs on this page did not go through plimsoll and carry no run record. What you can check instead is every raw result file and log, the exact commits, and the rerun above, which gives the same answer test for test.