syzbot


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

Status: upstream: reported C repro on 2025/01/01 04:06
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+14d047423f40dc1dac89@syzkaller.appspotmail.com
First crash: 243d, last: 5d13h
Cause bisection: the cause commit could be any of (bisect log):
  568570fdf2b9 Merge tag 'xfs-6.12-fixes-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
  6aca91c416f6 cifs: Remove unused functions
  b04ae0f45168 Merge tag 'v6.12-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [mm?] [xfs?] KASAN: slab-use-after-free Read in filemap_map_pages 1 (3) 2025/01/01 07:20
Last patch testing requests (11)
Created Duration User Patch Repo Result
2025/06/13 11:40 23m retest repro linux-next OK log
2025/06/13 10:02 23m retest repro linux-next OK log
2025/06/13 10:02 39m retest repro linux-next OK log
2025/06/13 10:02 25m retest repro linux-next OK log
2025/06/13 10:02 23m retest repro linux-next OK log
2025/03/22 15:47 9m retest repro linux-next error
2025/03/22 15:47 12m retest repro linux-next error
2025/03/22 15:47 13m retest repro linux-next error
2025/03/22 15:47 9m retest repro linux-next error
2025/01/11 11:33 35m retest repro linux-next error
2025/01/01 06:50 29m hdanton@sina.com patch linux-next OK log

Sample crash report:
EXT4-fs error (device loop0): ext4_map_blocks:778: inode #15: block 3: comm syz.0.21: lblock 3 mapped to illegal pblock 3 (length 1)
EXT4-fs error (device loop0): ext4_map_blocks:778: inode #15: block 3: comm syz.0.21: lblock 3 mapped to illegal pblock 3 (length 1)
EXT4-fs error (device loop0): ext4_map_blocks:778: inode #15: block 3: comm syz.0.21: lblock 3 mapped to illegal pblock 3 (length 1)
==================================================================
BUG: KASAN: use-after-free in ptep_get include/linux/pgtable.h:340 [inline]
BUG: KASAN: use-after-free in filemap_map_folio_range mm/filemap.c:3666 [inline]
BUG: KASAN: use-after-free in filemap_map_pages+0xc95/0x1740 mm/filemap.c:3783
Read of size 8 at addr ffff8880319f3000 by task syz.0.21/6060

CPU: 1 UID: 0 PID: 6060 Comm: syz.0.21 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xca/0x240 mm/kasan/report.c:482
 kasan_report+0x118/0x150 mm/kasan/report.c:595
 ptep_get include/linux/pgtable.h:340 [inline]
 filemap_map_folio_range mm/filemap.c:3666 [inline]
 filemap_map_pages+0xc95/0x1740 mm/filemap.c:3783
 do_fault_around mm/memory.c:5531 [inline]
 do_read_fault mm/memory.c:5564 [inline]
 do_fault mm/memory.c:5707 [inline]
 do_pte_missing mm/memory.c:4234 [inline]
 handle_pte_fault mm/memory.c:6052 [inline]
 __handle_mm_fault+0x34ac/0x5440 mm/memory.c:6195
 handle_mm_fault+0x40a/0x8e0 mm/memory.c:6364
 faultin_page mm/gup.c:1144 [inline]
 __get_user_pages+0x1699/0x2ce0 mm/gup.c:1446
 populate_vma_page_range+0x29f/0x3a0 mm/gup.c:1880
 __mm_populate+0x24c/0x380 mm/gup.c:1983
 mm_populate include/linux/mm.h:3367 [inline]
 vm_mmap_pgoff+0x387/0x4d0 mm/util.c:585
 ksys_mmap_pgoff+0x51f/0x760 mm/mmap.c:604
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f157618ebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f15770a6038 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007f15763b5fa0 RCX: 00007f157618ebe9
RDX: 00000000027ffff7 RSI: 0000000000600000 RDI: 0000200000000000
RBP: 00007f1576211e19 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000004012011 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f15763b6038 R14: 00007f15763b5fa0 R15: 00007fff4ca3fb28
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880319f3c80 pfn:0x319f3
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f0(buddy)
raw: 00fff00000000000 ffffea0000c60108 ffffea0001dca348 0000000000000000
raw: ffff8880319f3c80 0000000000000000 00000000f0000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_ZERO|__GFP_NOWARN), pid 5929, tgid 5929 (syz-executor), ts 77864005374, free_ts 78063336401
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
 prep_new_page mm/page_alloc.c:1859 [inline]
 get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
 alloc_frozen_pages_noprof mm/mempolicy.c:2487 [inline]
 alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2507
 vm_area_alloc_pages mm/vmalloc.c:3642 [inline]
 __vmalloc_area_node mm/vmalloc.c:3720 [inline]
 __vmalloc_node_range_noprof+0x97d/0x12f0 mm/vmalloc.c:3893
 vmalloc_user_noprof+0xad/0xf0 mm/vmalloc.c:4046
 kcov_ioctl+0x55/0x640 kernel/kcov.c:716
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:598 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 5930 tgid 5930 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1395 [inline]
 __free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2895
 vfree+0x25a/0x400 mm/vmalloc.c:3434
 kcov_put kernel/kcov.c:439 [inline]
 kcov_close+0x28/0x50 kernel/kcov.c:535
 __fput+0x44c/0xa70 fs/file_table.c:468
 task_work_run+0x1d4/0x260 kernel/task_work.c:227
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0x6b5/0x2300 kernel/exit.c:961
 do_group_exit+0x21c/0x2d0 kernel/exit.c:1102
 get_signal+0x1286/0x1340 kernel/signal.c:3034
 arch_do_signal_or_restart+0x9a/0x750 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop+0x75/0x110 kernel/entry/common.c:40
 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline]
 do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff8880319f2f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880319f2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880319f3000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff8880319f3080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880319f3100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (12):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/20 07:58 upstream b19a97d57c15 79512909 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci-upstream-kasan-gce-root KASAN: use-after-free Read in filemap_map_pages
2025/05/29 09:08 upstream 90b83efa6701 3d2f584d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root KASAN: slab-use-after-free Read in filemap_map_pages
2025/04/15 05:16 upstream 834a4a689699 0bd6db41 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in filemap_map_pages
2025/02/03 17:41 upstream 2014c95afece a21a8419 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in filemap_map_pages
2024/12/28 10:49 linux-next 8155b4ef3466 d3ccff63 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in filemap_map_pages
2024/12/28 08:59 linux-next 8155b4ef3466 d3ccff63 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in filemap_map_pages
2024/12/28 08:03 linux-next 8155b4ef3466 d3ccff63 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in filemap_map_pages
2024/12/28 07:04 linux-next 8155b4ef3466 d3ccff63 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in filemap_map_pages
2024/12/28 03:56 linux-next 8155b4ef3466 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in filemap_map_pages
2025/07/21 08:53 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci aaef6f251176 7117feec .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in filemap_map_pages
2025/08/23 07:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 8f5ae30d69d7 bf27483f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in filemap_map_pages
2025/08/18 10:21 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 8f5ae30d69d7 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in filemap_map_pages
* Struck through repros no longer work on HEAD.