Skip to contentSkip to conversation

linux-next: build failure after merge of the tip tree

DISCUSSION Mark Brown 4 participants 13 messages Mar 10 – Mar 12 Linux-next tree

lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

Hi all,

After merging the tip tree, today's linux-next started crashing running arm64 KUnit like this:

[18:12:16] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel)
[18:12:16] =============== [PASSED] test_split_convert ================
[18:12:16] ================ [PASSED] ext4_extents_test ================
[18:12:16] ============== ext4_mballoc_test (7 subtests) ==============
Command '['qemu-system-aarch64', '-nodefaults', '-m', '1024', '-kernel', '/tmp/next/arm64_kunit/arch/arm64/boot/Image.gz', '-append', 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot', '-no-reboot', '-nographic', '-accel', 'kvm', '-accel', 'hvf', '-accel', 'tcg', '-serial', 'stdio', '-machine', 'virt', '-cpu', 'max']' timed out after 300 seconds

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

author maintainer
#1 lore raw
Quoted 5 lines · Mark Brown

Hi all,

After merging the tip tree, today's linux-next started crashing running arm64 KUnit like this:

Quoted 8 lines

[18:12:16] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel)
[18:12:16] =============== [PASSED] test_split_convert ================
[18:12:16] ================ [PASSED] ext4_extents_test ================
[18:12:16] ============== ext4_mballoc_test (7 subtests) ==============
Command '['qemu-system-aarch64', '-nodefaults', '-m', '1024', '-kernel', '/tmp/next/arm64_kunit/arch/arm64/boot/Image.gz', '-append', 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot', '-no-reboot', '-nographic', '-accel', 'kvm', '-accel', 'hvf', '-accel', 'tcg', '-serial', 'stdio', '-machine', 'virt', '-cpu', 'max']' timed out after 300 seconds

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

I tried to leave a bisect running but it got confused because a lot of the branches are based on v7.0-rc1 which has a separate bug that causes KUnit to lock up so the results are nonsense. I did confirm an issue with just tip/master. My KUnit command line running on current Debian stable is:

    ./tools/testing/kunit/kunit.py run --alltests --arch arm64 --cross_compile=aarch64-linux-gnu-

and I also tried:

    ./tools/testing/kunit/kunit.py run --alltests --arch x86_64 --cross_compile=x86_64-linux-gnu-

and got:

[23:51:03] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel) [23:51:03] =============== [PASSED] test_split_convert ================
[23:51:03] ================ [PASSED] ext4_extents_test ================
[23:51:03] ============== ext4_mballoc_test (7 subtests) ==============
[23:51:03] ================= test_new_blocks_simple ==================
[23:51:03] [FAILED] block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64

before the deadlock which looks awfully similar, though it does make a bit more progress and gives a crash:

[23:55:51] [ERROR] Test: test_new_blocks_simple: missing subtest result line! [23:55:51] BUG: unable to handle page fault for address: 00000008bcf958c7 [23:55:51] #PF: supervisor write access in kernel mode
[23:55:51] #PF: error_code(0x0002) - not-present page

...

[23:58:45] Call Trace:
[23:58:45] <TASK>
[23:58:45] ext4_mb_release (??:?)
[23:58:45] mbt_kunit_exit (mballoc.c:?)
[23:58:45] ? __pfx_kunit_generic_run_threadfn_adapter (try-catch.c:?) [23:58:45] kunit_try_run_case_cleanup (test.c:?) [23:58:45] kunit_generic_run_threadfn_adapter (try-catch.c:?) [23:58:45] kthread (kthread.c:?)
[23:58:45] ? __pfx_kthread (kthread.c:?)
[23:58:45] ret_from_fork (??:?)
[23:58:45] ? __pfx_kthread (kthread.c:?)
[23:58:45] ret_from_fork_asm (??:?)

plus subsequent things that look like aftereffects of the same thing.

#2 lore raw
Quoted 27 lines · Mark Brown
Quoted 5 lines · Mark Brown

Hi all,

After merging the tip tree, today's linux-next started crashing running arm64 KUnit like this:

Quoted 8 lines

[18:12:16] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel)
[18:12:16] =============== [PASSED] test_split_convert ================
[18:12:16] ================ [PASSED] ext4_extents_test ================
[18:12:16] ============== ext4_mballoc_test (7 subtests) ==============
Command '['qemu-system-aarch64', '-nodefaults', '-m', '1024', '-kernel', '/tmp/next/arm64_kunit/arch/arm64/boot/Image.gz', '-append', 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot', '-no-reboot', '-nographic', '-accel', 'kvm', '-accel', 'hvf', '-accel', 'tcg', '-serial', 'stdio', '-machine', 'virt', '-cpu', 'max']' timed out after 300 seconds

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

I tried to leave a bisect running but it got confused because a lot of the branches are based on v7.0-rc1 which has a separate bug that causes KUnit to lock up so the results are nonsense. I did confirm an issue with just tip/master. My KUnit command line running on current Debian stable is:

    ./tools/testing/kunit/kunit.py run --alltests --arch arm64 --cross_compile=aarch64-linux-gnu-

and I also tried:

    ./tools/testing/kunit/kunit.py run --alltests --arch x86_64 --cross_compile=x86_64-linux-gnu-
Quoted 8 lines

and got:

[23:51:03] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel) [23:51:03] =============== [PASSED] test_split_convert ================
[23:51:03] ================ [PASSED] ext4_extents_test ================
[23:51:03] ============== ext4_mballoc_test (7 subtests) ==============
[23:51:03] ================= test_new_blocks_simple ==================
[23:51:03] [FAILED] block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64

Right, so I bisected this using:

  ./tools/testing/kunit/kunit.py run --alltests --build_dir=$PWD/kunit-build/ --arch=x86_64 ext4_*

and hit:

25500ba7e77c ("locking/mutex: Remove the list_head from struct mutex")

After much staring, I couldn't find anything wrong with it, and decided to add a few DEBUG options on. And it magically started working.

Then I did a KASAN run of the above, and that got me the below. There seems to have been some recent commits in this area, Cc'ed relevant people.

[11:17:27] ================================================================== [11:17:27] BUG: KASAN: slab-use-after-free in __percpu_counter_init_many+0x21b/0x2f0 [11:17:27] Write of size 8 at addr ffff8880029425a8 by task kunit_try_catch/37 [11:17:27]
[11:17:27] CPU: 0 UID: 0 PID: 37 Comm: kunit_try_catch Tainted: G N 7.0.0-rc1-00023-g25500ba7e77c #3 PREEMPT(lazy)
[11:17:27] Tainted: [N]=TEST
[11:17:27] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.1 11/11/2019 [11:17:27] Call Trace:

[11:17:27]  <TASK>
[11:17:27]  dump_stack_lvl+0x4e/0x70
[11:17:27]  print_report+0x152/0x4b0
[11:17:27]  ? __pfx__raw_spin_lock_irqsave+0x10/0x10
[11:17:27]  ? __pfx_mutex_unlock+0x10/0x10
[11:17:27]  ? __percpu_counter_init_many+0x21b/0x2f0
[11:17:27]  kasan_report+0xe0/0x110
[11:17:27]  ? __percpu_counter_init_many+0x21b/0x2f0
[11:17:27]  __percpu_counter_init_many+0x21b/0x2f0
[11:17:27]  ext4_es_register_shrinker+0x115/0x3e0
[11:17:27]  ? kasan_save_track+0x14/0x30
[11:17:27]  extents_kunit_init+0x1d1/0x890
[11:17:27]  kunit_try_run_case+0x170/0x2d0
[11:17:27]  ? __pfx_kunit_try_run_case+0x10/0x10
[11:17:27]  ? kthread_affine_node+0x1b3/0x250
[11:17:27]  ? __pfx_kthread_affine_node+0x10/0x10
[11:17:27]  ? __pfx_kunit_try_run_case+0x10/0x10
[11:17:27]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[11:17:27]  kunit_generic_run_threadfn_adapter+0x7b/0xe0
[11:17:27]  kthread+0x2dc/0x3c0
[11:17:27]  ? recalc_sigpending+0x15d/0x1e0
[11:17:27]  ? __pfx_kthread+0x10/0x10
[11:17:27]  ret_from_fork+0x445/0x610
[11:17:27]  ? __pfx_ret_from_fork+0x10/0x10
[11:17:27]  ? __switch_to+0x31/0xd60
[11:17:27]  ? __switch_to_asm+0x39/0x70
[11:17:27]  ? __switch_to_asm+0x33/0x70
[11:17:27]  ? __pfx_kthread+0x10/0x10
[11:17:27]  ret_from_fork_asm+0x1a/0x30
[11:17:27]  </TASK>
[11:17:27]
[11:17:27] Allocated by task 35:
[11:17:27]  kasan_save_stack+0x30/0x50
[11:17:27]  kasan_save_track+0x14/0x30
[11:17:27]  __kasan_kmalloc+0x8f/0xa0
[11:17:27]  extents_kunit_init+0xf0/0x890
[11:17:27]  kunit_try_run_case+0x170/0x2d0
[11:17:27]  kunit_generic_run_threadfn_adapter+0x7b/0xe0
[11:17:27]  kthread+0x2dc/0x3c0
[11:17:27]  ret_from_fork+0x445/0x610
[11:17:27]  ret_from_fork_asm+0x1a/0x30
[11:17:27]
[11:17:27] Freed by task 36:
[11:17:27]  kasan_save_stack+0x30/0x50
[11:17:27]  kasan_save_track+0x14/0x30
[11:17:27]  kasan_save_free_info+0x3b/0x60
[11:17:27]  __kasan_slab_free+0x43/0x70
[11:17:27]  kfree+0x130/0x330
[11:17:27]  extents_kunit_exit+0x5b/0x90
[11:17:27]  kunit_try_run_case_cleanup+0xad/0xe0
[11:17:27]  kunit_generic_run_threadfn_adapter+0x7b/0xe0
[11:17:27]  kthread+0x2dc/0x3c0
[11:17:27]  ret_from_fork+0x445/0x610
[11:17:27]  ret_from_fork_asm+0x1a/0x30

[11:17:27]
[11:17:27] The buggy address belongs to the object at ffff888002942000 [11:17:27] which belongs to the cache kmalloc-4k of size 4096 [11:17:27] The buggy address is located 1448 bytes inside of [11:17:27] freed 4096-byte region [ffff888002942000, ffff888002943000) [11:17:27]
[11:17:27] The buggy address belongs to the physical page:
[11:17:27] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2940 [11:17:27] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [11:17:27] flags: 0x4000000000000040(head|zone=1)
[11:17:27] page_type: f5(slab)
[11:17:27] raw: 4000000000000040 ffff888001041d00 dead000000000100 dead000000000122 [11:17:27] raw: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000 [11:17:27] head: 4000000000000040 ffff888001041d00 dead000000000100 dead000000000122 [11:17:27] head: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000 [11:17:27] head: 4000000000000003 ffffea00000a5001 00000000ffffffff 00000000ffffffff [11:17:27] head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 [11:17:27] page dumped because: kasan: bad access detected
[11:17:27]
[11:17:27] Memory state around the buggy address:
[11:17:27] ffff888002942480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] ffff888002942500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] >ffff888002942580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[11:17:27] ^
[11:17:27] ffff888002942600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] ffff888002942680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] ================================================================== [11:17:27] Disabling lock debugging due to kernel taint
[11:17:27] # [extent 0] exp: lblk:10 len:1 unwrit:1
[11:17:27] # [extent 0] got: lblk:10 len:1 unwrit:1
[11:17:27] ------------------
[11:17:27] # [extent 1] exp: lblk:11 len:2 unwrit:0
[11:17:27] # [extent 1] got: lblk:11 len:2 unwrit:0
[11:17:27] ------------------
[11:17:27] [FAILED] split unwrit extent to 2 extents and convert 2nd half writ

#3 lore raw
Quoted 49 lines · Peter Zijlstra
Quoted 27 lines · Mark Brown
Quoted 5 lines · Mark Brown

Hi all,

After merging the tip tree, today's linux-next started crashing running arm64 KUnit like this:

Quoted 8 lines

[18:12:16] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel)
[18:12:16] =============== [PASSED] test_split_convert ================
[18:12:16] ================ [PASSED] ext4_extents_test ================
[18:12:16] ============== ext4_mballoc_test (7 subtests) ==============
Command '['qemu-system-aarch64', '-nodefaults', '-m', '1024', '-kernel', '/tmp/next/arm64_kunit/arch/arm64/boot/Image.gz', '-append', 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot', '-no-reboot', '-nographic', '-accel', 'kvm', '-accel', 'hvf', '-accel', 'tcg', '-serial', 'stdio', '-machine', 'virt', '-cpu', 'max']' timed out after 300 seconds

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

I tried to leave a bisect running but it got confused because a lot of the branches are based on v7.0-rc1 which has a separate bug that causes KUnit to lock up so the results are nonsense. I did confirm an issue with just tip/master. My KUnit command line running on current Debian stable is:

    ./tools/testing/kunit/kunit.py run --alltests --arch arm64 --cross_compile=aarch64-linux-gnu-

and I also tried:

    ./tools/testing/kunit/kunit.py run --alltests --arch x86_64 --cross_compile=x86_64-linux-gnu-
Quoted 8 lines

and got:

[23:51:03] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel) [23:51:03] =============== [PASSED] test_split_convert ================
[23:51:03] ================ [PASSED] ext4_extents_test ================
[23:51:03] ============== ext4_mballoc_test (7 subtests) ==============
[23:51:03] ================= test_new_blocks_simple ==================
[23:51:03] [FAILED] block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64

Right, so I bisected this using:

  ./tools/testing/kunit/kunit.py run --alltests --build_dir=$PWD/kunit-build/ --arch=x86_64 ext4_*

and hit:

25500ba7e77c ("locking/mutex: Remove the list_head from struct mutex")

After much staring, I couldn't find anything wrong with it, and decided to add a few DEBUG options on. And it magically started working.

Quoted 7 lines

Then I did a KASAN run of the above, and that got me the below. There seems to have been some recent commits in this area, Cc'ed relevant people.

[11:17:27] ================================================================== [11:17:27] BUG: KASAN: slab-use-after-free in __percpu_counter_init_many+0x21b/0x2f0 [11:17:27] Write of size 8 at addr ffff8880029425a8 by task kunit_try_catch/37

Hi Peter,

I believe this issue is resolved with [1]. However, I think this might not be the same as the issue reported originally as we the original issue seems to be in mballoc-tests rather than extent-tests. I'll try to look into it a bit more.

[1] https://lore.kernel.org/linux-ext4/5bb9041471dab8ce870c191c19cbe4df57473be8.1772381213.git.ritesh.list@gmail.com/

Regards,
ojaswin

Quoted 95 lines

[11:17:27]
[11:17:27] CPU: 0 UID: 0 PID: 37 Comm: kunit_try_catch Tainted: G N 7.0.0-rc1-00023-g25500ba7e77c #3 PREEMPT(lazy)
[11:17:27] Tainted: [N]=TEST
[11:17:27] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.1 11/11/2019 [11:17:27] Call Trace:

[11:17:27]  <TASK>
[11:17:27]  dump_stack_lvl+0x4e/0x70
[11:17:27]  print_report+0x152/0x4b0
[11:17:27]  ? __pfx__raw_spin_lock_irqsave+0x10/0x10
[11:17:27]  ? __pfx_mutex_unlock+0x10/0x10
[11:17:27]  ? __percpu_counter_init_many+0x21b/0x2f0
[11:17:27]  kasan_report+0xe0/0x110
[11:17:27]  ? __percpu_counter_init_many+0x21b/0x2f0
[11:17:27]  __percpu_counter_init_many+0x21b/0x2f0
[11:17:27]  ext4_es_register_shrinker+0x115/0x3e0
[11:17:27]  ? kasan_save_track+0x14/0x30
[11:17:27]  extents_kunit_init+0x1d1/0x890
[11:17:27]  kunit_try_run_case+0x170/0x2d0
[11:17:27]  ? __pfx_kunit_try_run_case+0x10/0x10
[11:17:27]  ? kthread_affine_node+0x1b3/0x250
[11:17:27]  ? __pfx_kthread_affine_node+0x10/0x10
[11:17:27]  ? __pfx_kunit_try_run_case+0x10/0x10
[11:17:27]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[11:17:27]  kunit_generic_run_threadfn_adapter+0x7b/0xe0
[11:17:27]  kthread+0x2dc/0x3c0
[11:17:27]  ? recalc_sigpending+0x15d/0x1e0
[11:17:27]  ? __pfx_kthread+0x10/0x10
[11:17:27]  ret_from_fork+0x445/0x610
[11:17:27]  ? __pfx_ret_from_fork+0x10/0x10
[11:17:27]  ? __switch_to+0x31/0xd60
[11:17:27]  ? __switch_to_asm+0x39/0x70
[11:17:27]  ? __switch_to_asm+0x33/0x70
[11:17:27]  ? __pfx_kthread+0x10/0x10
[11:17:27]  ret_from_fork_asm+0x1a/0x30
[11:17:27]  </TASK>
[11:17:27]
[11:17:27] Allocated by task 35:
[11:17:27]  kasan_save_stack+0x30/0x50
[11:17:27]  kasan_save_track+0x14/0x30
[11:17:27]  __kasan_kmalloc+0x8f/0xa0
[11:17:27]  extents_kunit_init+0xf0/0x890
[11:17:27]  kunit_try_run_case+0x170/0x2d0
[11:17:27]  kunit_generic_run_threadfn_adapter+0x7b/0xe0
[11:17:27]  kthread+0x2dc/0x3c0
[11:17:27]  ret_from_fork+0x445/0x610
[11:17:27]  ret_from_fork_asm+0x1a/0x30
[11:17:27]
[11:17:27] Freed by task 36:
[11:17:27]  kasan_save_stack+0x30/0x50
[11:17:27]  kasan_save_track+0x14/0x30
[11:17:27]  kasan_save_free_info+0x3b/0x60
[11:17:27]  __kasan_slab_free+0x43/0x70
[11:17:27]  kfree+0x130/0x330
[11:17:27]  extents_kunit_exit+0x5b/0x90
[11:17:27]  kunit_try_run_case_cleanup+0xad/0xe0
[11:17:27]  kunit_generic_run_threadfn_adapter+0x7b/0xe0
[11:17:27]  kthread+0x2dc/0x3c0
[11:17:27]  ret_from_fork+0x445/0x610
[11:17:27]  ret_from_fork_asm+0x1a/0x30

[11:17:27]
[11:17:27] The buggy address belongs to the object at ffff888002942000 [11:17:27] which belongs to the cache kmalloc-4k of size 4096 [11:17:27] The buggy address is located 1448 bytes inside of [11:17:27] freed 4096-byte region [ffff888002942000, ffff888002943000) [11:17:27]
[11:17:27] The buggy address belongs to the physical page:
[11:17:27] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2940 [11:17:27] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [11:17:27] flags: 0x4000000000000040(head|zone=1)
[11:17:27] page_type: f5(slab)
[11:17:27] raw: 4000000000000040 ffff888001041d00 dead000000000100 dead000000000122 [11:17:27] raw: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000 [11:17:27] head: 4000000000000040 ffff888001041d00 dead000000000100 dead000000000122 [11:17:27] head: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000 [11:17:27] head: 4000000000000003 ffffea00000a5001 00000000ffffffff 00000000ffffffff [11:17:27] head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 [11:17:27] page dumped because: kasan: bad access detected
[11:17:27]
[11:17:27] Memory state around the buggy address:
[11:17:27] ffff888002942480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] ffff888002942500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] >ffff888002942580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[11:17:27] ^
[11:17:27] ffff888002942600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] ffff888002942680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [11:17:27] ================================================================== [11:17:27] Disabling lock debugging due to kernel taint
[11:17:27] # [extent 0] exp: lblk:10 len:1 unwrit:1
[11:17:27] # [extent 0] got: lblk:10 len:1 unwrit:1
[11:17:27] ------------------
[11:17:27] # [extent 1] exp: lblk:11 len:2 unwrit:0
[11:17:27] # [extent 1] got: lblk:11 len:2 unwrit:0
[11:17:27] ------------------
[11:17:27] [FAILED] split unwrit extent to 2 extents and convert 2nd half writ

Tested-by
#4 lore raw
Quoted 6 lines · Ojaswin Mujoo
Quoted 3 lines · Peter Zijlstra

[11:17:27] ================================================================== [11:17:27] BUG: KASAN: slab-use-after-free in __percpu_counter_init_many+0x21b/0x2f0 [11:17:27] Write of size 8 at addr ffff8880029425a8 by task kunit_try_catch/37

Quoted 8 lines

Hi Peter,

I believe this issue is resolved with [1]. However, I think this might not be the same as the issue reported originally as we the original issue seems to be in mballoc-tests rather than extent-tests. I'll try to look into it a bit more.

[1] https://lore.kernel.org/linux-ext4/5bb9041471dab8ce870c191c19cbe4df57473be8.1772381213.git.ritesh.list@gmail.com/

I can confirm that solves the KASAN splat; it also cures the defconfig hang that was initially mis-attributed to the mutex patch, but turned out to be memory corruption due to that issue KASAN found.

FWIW:

author maintainer Tested-by
#5 lore raw
Quoted 10 lines · Peter Zijlstra
Quoted 8 lines · Ojaswin Mujoo

On Wed, Mar 11, 2026 at 11:37:43AM +0100, Peter Zijlstra wrote:

I believe this issue is resolved with [1]. However, I think this might not be the same as the issue reported originally as we the original issue seems to be in mballoc-tests rather than extent-tests. I'll try to look into it a bit more.

[1] https://lore.kernel.org/linux-ext4/5bb9041471dab8ce870c191c19cbe4df57473be8.1772381213.git.ritesh.list@gmail.com/

Quoted 7 lines

I can confirm that solves the KASAN splat; it also cures the defconfig hang that was initially mis-attributed to the mutex patch, but turned out to be memory corruption due to that issue KASAN found.

FWIW:

Yes, that seems to work for me too - looks like tip just triggers it more aggressively for some reason:

#6 lore raw
Quoted 15 lines · Mark Brown
Quoted 13 lines · Peter Zijlstra
Quoted 8 lines · Ojaswin Mujoo

On Wed, Mar 11, 2026 at 11:37:43AM +0100, Peter Zijlstra wrote:

I believe this issue is resolved with [1]. However, I think this might not be the same as the issue reported originally as we the original issue seems to be in mballoc-tests rather than extent-tests. I'll try to look into it a bit more.

[1] https://lore.kernel.org/linux-ext4/5bb9041471dab8ce870c191c19cbe4df57473be8.1772381213.git.ritesh.list@gmail.com/

I can confirm that solves the KASAN splat; it also cures the defconfig hang that was initially mis-attributed to the mutex patch, but turned out to be memory corruption due to that issue KASAN found.

Quoted 8 lines
Quoted 3 lines

FWIW:

Yes, that seems to work for me too - looks like tip just triggers it more aggressively for some reason:

Thanks Mark, Peter & Ojaswin for testing.

++linux-ext4 so that if someone observes the same issue in ext4 kunit tests, they could find this discussion on linux-ext4.

-ritesh

#7 lore raw
In reply to Peter Zijlstra
Quoted 16 lines · Peter Zijlstra
Quoted 6 lines · Ojaswin Mujoo
Quoted 3 lines · Peter Zijlstra

[11:17:27] ================================================================== [11:17:27] BUG: KASAN: slab-use-after-free in __percpu_counter_init_many+0x21b/0x2f0 [11:17:27] Write of size 8 at addr ffff8880029425a8 by task kunit_try_catch/37

Quoted 8 lines

Hi Peter,

I believe this issue is resolved with [1]. However, I think this might not be the same as the issue reported originally as we the original issue seems to be in mballoc-tests rather than extent-tests. I'll try to look into it a bit more.

[1] https://lore.kernel.org/linux-ext4/5bb9041471dab8ce870c191c19cbe4df57473be8.1772381213.git.ritesh.list@gmail.com/

Quoted 7 lines

I can confirm that solves the KASAN splat; it also cures the defconfig hang that was initially mis-attributed to the mutex patch, but turned out to be memory corruption due to that issue KASAN found.

FWIW:

Awesome, thanks for testing.

Regards,
ojaswin

#8 lore raw
In reply to Mark Brown
Quoted 59 lines · Mark Brown
Quoted 5 lines · Mark Brown

Hi all,

After merging the tip tree, today's linux-next started crashing running arm64 KUnit like this:

Quoted 8 lines

[18:12:16] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel)
[18:12:16] =============== [PASSED] test_split_convert ================
[18:12:16] ================ [PASSED] ext4_extents_test ================
[18:12:16] ============== ext4_mballoc_test (7 subtests) ==============
Command '['qemu-system-aarch64', '-nodefaults', '-m', '1024', '-kernel', '/tmp/next/arm64_kunit/arch/arm64/boot/Image.gz', '-append', 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot', '-no-reboot', '-nographic', '-accel', 'kvm', '-accel', 'hvf', '-accel', 'tcg', '-serial', 'stdio', '-machine', 'virt', '-cpu', 'max']' timed out after 300 seconds

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

I tried to leave a bisect running but it got confused because a lot of the branches are based on v7.0-rc1 which has a separate bug that causes KUnit to lock up so the results are nonsense. I did confirm an issue with just tip/master. My KUnit command line running on current Debian stable is:

    ./tools/testing/kunit/kunit.py run --alltests --arch arm64 --cross_compile=aarch64-linux-gnu-

and I also tried:

    ./tools/testing/kunit/kunit.py run --alltests --arch x86_64 --cross_compile=x86_64-linux-gnu-

and got:

[23:51:03] [PASSED] split unwrit extent to 3 extents and convert 2nd half writ (non-endio, zeroout) (highlevel) [23:51:03] =============== [PASSED] test_split_convert ================
[23:51:03] ================ [PASSED] ext4_extents_test ================
[23:51:03] ============== ext4_mballoc_test (7 subtests) ==============
[23:51:03] ================= test_new_blocks_simple ==================
[23:51:03] [FAILED] block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64

before the deadlock which looks awfully similar, though it does make a bit more progress and gives a crash:

[23:55:51] [ERROR] Test: test_new_blocks_simple: missing subtest result line! [23:55:51] BUG: unable to handle page fault for address: 00000008bcf958c7 [23:55:51] #PF: supervisor write access in kernel mode
[23:55:51] #PF: error_code(0x0002) - not-present page

...

[23:58:45] Call Trace:
[23:58:45] <TASK>
[23:58:45] ext4_mb_release (??:?)
[23:58:45] mbt_kunit_exit (mballoc.c:?)
[23:58:45] ? __pfx_kunit_generic_run_threadfn_adapter (try-catch.c:?) [23:58:45] kunit_try_run_case_cleanup (test.c:?) [23:58:45] kunit_generic_run_threadfn_adapter (try-catch.c:?) [23:58:45] kthread (kthread.c:?)
[23:58:45] ? __pfx_kthread (kthread.c:?)
[23:58:45] ret_from_fork (??:?)
[23:58:45] ? __pfx_kthread (kthread.c:?)
[23:58:45] ret_from_fork_asm (??:?)

Quoted 1 line

plus subsequent things that look like aftereffects of the same thing.

Hi Mark, I'm unable to hit this bug with the 20260310 branch [1]. Am I on the wrong branch? I'm using the following command on x86 machine:

tools/testing/kunit/kunit.py run --alltests --arch x86_64

Also IIUC there's another deadlock issue you are
facing other than the one here? Would you be able to try out this patchset [2], it fixes some of the cleanup related functions which might fix this issue.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tag/?h=next-20260310
[2] https://lore.kernel.org/linux-ext4/[email protected]/T/#t

Regards,
ojaswin

author maintainer
#9 lore raw
Quoted 9 lines · Ojaswin Mujoo
Quoted 7 lines · Mark Brown
Quoted 2 lines · Mark Brown

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

with just tip/master. My KUnit command line running on current Debian stable is:

Quoted 6 lines
Quoted 3 lines
    ./tools/testing/kunit/kunit.py run --alltests --arch arm64 --cross_compile=aarch64-linux-gnu-

    ./tools/testing/kunit/kunit.py run --alltests --arch x86_64 --cross_compile=x86_64-linux-gnu-

Hi Mark, I'm unable to hit this bug with the 20260310 branch [1]. Am I on the wrong branch? I'm using the following command on x86 machine:

See above, because of this test failure I did not merge the current version of the tip tree which triggers the issue, you need to fetch the tip tree:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master

Quoted 4 lines

Also IIUC there's another deadlock issue you are
facing other than the one here? Would you be able to try out this patchset [2], it fixes some of the cleanup related functions which might fix this issue.

There was a delightful issue which is already fixed in current mainline:

https://lore.kernel.org/r/20260224-mittlerweile-besessen-2738831ae7f6@brauner

but which was present in -rc1. I've not seen anything specifically about any ext4 issues.

#10 lore raw
Quoted 14 lines · Mark Brown
Quoted 12 lines · Ojaswin Mujoo
Quoted 11 lines · Mark Brown
Quoted 2 lines · Mark Brown

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

with just tip/master. My KUnit command line running on current Debian stable is:

    ./tools/testing/kunit/kunit.py run --alltests --arch arm64 --cross_compile=aarch64-linux-gnu-

    ./tools/testing/kunit/kunit.py run --alltests --arch x86_64 --cross_compile=x86_64-linux-gnu-
Quoted 8 lines
Quoted 2 lines

Hi Mark, I'm unable to hit this bug with the 20260310 branch [1]. Am I on the wrong branch? I'm using the following command on x86 machine:

See above, because of this test failure I did not merge the current version of the tip tree which triggers the issue, you need to fetch the tip tree:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master

Ahh I see. I didn't know about this tree. Thanks I'll check it.

Quoted 6 lines
Quoted 5 lines

Also IIUC there's another deadlock issue you are
facing other than the one here? Would you be able to try out this patchset [2], it fixes some of the cleanup related functions which might fix this issue.

Quoted 6 lines

There was a delightful issue which is already fixed in current mainline:

   https://lore.kernel.org/r/20260224-mittlerweile-besessen-2738831ae7f6@brauner

but which was present in -rc1. I've not seen anything specifically about any ext4 issues.

Got it, thanks
Ojaswin

#11 lore raw
Quoted 18 lines · Ojaswin Mujoo
Quoted 17 lines · Mark Brown
Quoted 15 lines · Ojaswin Mujoo
Quoted 11 lines · Mark Brown
Quoted 2 lines · Mark Brown

I didn't figure out what the source of the issue was, I merged the tip tree from 20260309 instead.

with just tip/master. My KUnit command line running on current Debian stable is:

    ./tools/testing/kunit/kunit.py run --alltests --arch arm64 --cross_compile=aarch64-linux-gnu-

    ./tools/testing/kunit/kunit.py run --alltests --arch x86_64 --cross_compile=x86_64-linux-gnu-

Hi Mark, I'm unable to hit this bug with the 20260310 branch [1]. Am I on the wrong branch? I'm using the following command on x86 machine:

Quoted 7 lines
Quoted 5 lines

See above, because of this test failure I did not merge the current version of the tip tree which triggers the issue, you need to fetch the tip tree:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master

Ahh I see. I didn't know about this tree. Thanks I'll check it.

Hi Mark,

Im able to replicate and confirm the following patch fixes it:

https://lore.kernel.org/linux-ext4/5bb9041471dab8ce870c191c19cbe4df57473be8.1772381213.git.ritesh.list@gmail.com/

I believe the previous test's cleanup is not going through properly causing the mballoc test to fault.

Thanks,
ojaswin