syzbot


KASAN: slab-use-after-free Read in mtree_range_walk

Status: upstream: reported on 2025/11/11 10:02
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+131f9eb2b5807573275c@syzkaller.appspotmail.com
Fix commit: mm/mmap_lock: reset maple state on lock_vma_under_rcu() retry
Patched on: [ci-upstream-linux-next-kasan-gce-root ci-upstream-rust-kasan-gce], missing on: [ci-qemu-gce-upstream-auto ci-qemu-native-arm64-kvm ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb]
First crash: 15d, last: 1d07h
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] mm/mmap_lock: Reset maple state on lock_vma_under_rcu() retry 19 (19) 2025/11/21 16:52
[syzbot] [mm?] KASAN: slab-use-after-free Read in mtree_range_walk 0 (1) 2025/11/11 10:02
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in mtree_range_walk mm 19 3 1117d 1127d 0/29 auto-obsoleted due to no activity on 2023/03/01 05:42

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in ma_data_end lib/maple_tree.c:1255 [inline]
BUG: KASAN: slab-use-after-free in mtree_range_walk+0x604/0x8d0 lib/maple_tree.c:2556
Read of size 8 at addr 6af0000015a8e778 by task syz.0.1085/6110
Pointer tag: [6a], memory tag: [fe]

CPU: 0 UID: 0 PID: 6110 Comm: syz.0.1085 Not tainted syzkaller #0 PREEMPT 
Hardware name: linux,dummy-virt (DT)
Call trace:
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:499 (C)
 __dump_stack+0x30/0x40 lib/dump_stack.c:94
 dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120
 print_address_description+0xac/0x288 mm/kasan/report.c:378
 print_report+0x84/0xa0 mm/kasan/report.c:482
 kasan_report+0xb0/0x110 mm/kasan/report.c:595
 kasan_tag_mismatch+0x28/0x3c mm/kasan/sw_tags.c:176
 __hwasan_tag_mismatch+0x30/0x60 arch/arm64/lib/kasan_sw_tags.S:55
 ma_data_end lib/maple_tree.c:1255 [inline]
 mtree_range_walk+0x604/0x8d0 lib/maple_tree.c:2556
 mas_state_walk lib/maple_tree.c:3296 [inline]
 mas_walk+0xf8/0x34c lib/maple_tree.c:4597
 lock_vma_under_rcu+0x10c/0x35c mm/mmap_lock.c:232
 do_page_fault+0x3a8/0x1508 arch/arm64/mm/fault.c:625
 do_mem_abort+0x50/0x110 arch/arm64/mm/fault.c:929
 el0_da+0x64/0x210 arch/arm64/kernel/entry-common.c:562
 el0t_64_sync_handler+0x90/0x12c arch/arm64/kernel/entry-common.c:768
 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596

Allocated by task 6110:
 kasan_save_stack+0x40/0x6c mm/kasan/common.c:56
 save_stack_info+0x30/0x138 mm/kasan/tags.c:106
 kasan_save_alloc_info+0x14/0x20 mm/kasan/tags.c:142
 unpoison_slab_object mm/kasan/common.c:342 [inline]
 __kasan_slab_alloc+0x94/0x98 mm/kasan/common.c:368
 kasan_slab_alloc include/linux/kasan.h:252 [inline]
 slab_post_alloc_hook mm/slub.c:4970 [inline]
 slab_alloc_node mm/slub.c:5280 [inline]
 kmem_cache_alloc_noprof+0x320/0x5a8 mm/slub.c:5287
 mt_alloc_one lib/maple_tree.c:172 [inline]
 mas_alloc_nodes+0x350/0x3b8 lib/maple_tree.c:1108
 mas_preallocate+0x544/0x970 lib/maple_tree.c:5192
 vma_iter_prealloc mm/vma.h:442 [inline]
 __split_vma+0x318/0xb00 mm/vma.c:528
 vms_gather_munmap_vmas+0x4d0/0x1474 mm/vma.c:1380
 __mmap_prepare mm/vma.c:2359 [inline]
 __mmap_region mm/vma.c:2652 [inline]
 mmap_region+0x6c0/0x1fcc mm/vma.c:2740
 do_mmap+0xa50/0xf64 mm/mmap.c:558
 vm_mmap_pgoff+0x290/0x3e8 mm/util.c:581
 ksys_mmap_pgoff+0xec/0x448 mm/mmap.c:604
 __do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
 __se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
 __arm64_sys_mmap+0x13c/0x198 arch/arm64/kernel/sys.c:21
 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
 invoke_syscall+0x90/0x238 arch/arm64/kernel/syscall.c:49
 el0_svc_common+0x180/0x2f4 arch/arm64/kernel/syscall.c:132
 do_el0_svc+0x58/0x74 arch/arm64/kernel/syscall.c:151
 el0_svc+0x5c/0x234 arch/arm64/kernel/entry-common.c:746
 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:765
 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596

Freed by task 6113:
 kasan_save_stack+0x40/0x6c mm/kasan/common.c:56
 save_stack_info+0x30/0x138 mm/kasan/tags.c:106
 __kasan_save_free_info+0x18/0x24 mm/kasan/tags.c:147
 kasan_save_free_info mm/kasan/kasan.h:406 [inline]
 poison_slab_object mm/kasan/common.c:252 [inline]
 __kasan_slab_free+0x64/0x68 mm/kasan/common.c:284
 kasan_slab_free include/linux/kasan.h:234 [inline]
 slab_free_hook mm/slub.c:2539 [inline]
 __rcu_free_sheaf_prepare+0x11c/0x2c4 mm/slub.c:2745
 rcu_free_sheaf+0x2c/0x138 mm/slub.c:6181
 rcu_do_batch kernel/rcu/tree.c:2605 [inline]
 rcu_core+0xe14/0x1d30 kernel/rcu/tree.c:2861
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2878
 handle_softirqs+0x36c/0xd08 kernel/softirq.c:622
 __do_softirq+0x14/0x20 kernel/softirq.c:656

The buggy address belongs to the object at fff0000015a8e700
 which belongs to the cache maple_node of size 256
The buggy address is located 120 bytes inside of
 256-byte region [fff0000015a8e700, fff0000015a8e800)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xd2f0000015a8ee00 pfn:0x55a8e
flags: 0x1ffc00000000200(workingset|node=0|zone=0|lastcpupid=0x7ff|kasantag=0x0)
page_type: f5(slab)
raw: 01ffc00000000200 7af000000cc09700 ffffc1ffc0492590 ffffc1ffc0373c10
raw: d2f0000015a8ee00 0000000000100008 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 fff0000015a8e500: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
 fff0000015a8e600: 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c
>fff0000015a8e700: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
                                        ^
 fff0000015a8e800: 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28
 fff0000015a8e900: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/11/21 11:17 git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next c9155843cbbc 52ed5c96 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-native-arm64-kvm KASAN: slab-use-after-free Read in mtree_range_walk
2025/11/12 17:00 git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next 1701b282ccc3 07e030de .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-native-arm64-kvm KASAN: slab-use-after-free Read in mtree_range_walk
2025/11/07 09:52 git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next dcb6fa37fd7b 4e1406b4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-native-arm64-kvm KASAN: slab-use-after-free Read in mtree_range_walk
* Struck through repros no longer work on HEAD.