syzbot


KASAN: use-after-free Read in lru_add_fn (2)

Status: upstream: reported C repro on 2025/07/09 05:00
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+89709151182ce9fda46c@syzkaller.appspotmail.com
First crash: 7d05h, last: 7d05h
Bug presence (1)
Date Name Commit Repro Result
2025/07/11 upstream (ToT) 40f92e79b0aa C [report] KASAN: slab-use-after-free Read in lru_add
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in lru_add_fn 19 42 384d 397d 0/3 auto-obsoleted due to no activity on 2024/09/04 15:15
upstream KASAN: slab-use-after-free Read in lru_add_fn nilfs mm 19 C inconclusive 68 384d 433d 27/29 fixed on 2024/08/14 19:57

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:72 [inline]
BUG: KASAN: use-after-free in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
BUG: KASAN: use-after-free in mapping_unevictable include/linux/pagemap.h:252 [inline]
BUG: KASAN: use-after-free in folio_evictable mm/internal.h:157 [inline]
BUG: KASAN: use-after-free in lru_add_fn+0x27b/0x17b0 mm/swap.c:202
Read of size 8 at addr ffff88802911d438 by task udevd/4275

CPU: 0 PID: 4275 Comm: udevd Not tainted 6.1.143-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0xa8/0x220 mm/kasan/report.c:427
 kasan_report+0x10b/0x140 mm/kasan/report.c:531
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x27b/0x290 mm/kasan/generic.c:189
 instrument_atomic_read include/linux/instrumented.h:72 [inline]
 _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
 mapping_unevictable include/linux/pagemap.h:252 [inline]
 folio_evictable mm/internal.h:157 [inline]
 lru_add_fn+0x27b/0x17b0 mm/swap.c:202
 folio_batch_move_lru+0x2bd/0x6a0 mm/swap.c:238
 lru_add_drain_cpu+0x10a/0x8c0 mm/swap.c:661
 lru_add_drain+0x11d/0x3e0 mm/swap.c:765
 __pagevec_release+0x44/0xe0 mm/swap.c:1052
 pagevec_release include/linux/pagevec.h:71 [inline]
 folio_batch_release include/linux/pagevec.h:135 [inline]
 shmem_undo_range+0x75b/0x2050 mm/shmem.c:946
 shmem_truncate_range mm/shmem.c:1062 [inline]
 shmem_evict_inode+0x248/0xa40 mm/shmem.c:1171
 evict+0x485/0x870 fs/inode.c:705
 __dentry_kill+0x431/0x650 fs/dcache.c:611
 dentry_kill+0xb8/0x290 fs/dcache.c:-1
 dput+0xfa/0x1d0 fs/dcache.c:918
 do_renameat2+0x8ad/0xc70 fs/namei.c:5029
 __do_sys_rename fs/namei.c:5073 [inline]
 __se_sys_rename fs/namei.c:5071 [inline]
 __x64_sys_rename+0x82/0x90 fs/namei.c:5071
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f3dd687acc7
Code: e8 5e a7 09 00 f7 d8 19 c0 5b c3 0f 1f 84 00 00 00 00 00 b8 ff ff ff ff 5b c3 66 0f 1f 84 00 00 00 00 00 b8 52 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 01 61 17 00 f7 d8 64 89 02 b8
RSP: 002b:00007ffdf6eda828 EFLAGS: 00000206 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 0000557842a3b1a0 RCX: 00007f3dd687acc7
RDX: 0000557842a18010 RSI: 00007ffdf6eda840 RDI: 00007ffdf6edac40
RBP: 0000557842a2d840 R08: 00000000000001e0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 00007ffdf6eda840
R13: 00007ffdf6edac40 R14: 0000000000000000 R15: 000055781b97b9dd
 </TASK>

Allocated by task 4424:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x6b/0x80 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x123/0x2f0 mm/slub.c:3422
 gfs2_glock_get+0x284/0xe90 fs/gfs2/glock.c:1180
 gfs2_inode_lookup+0x228/0xc80 fs/gfs2/inode.c:135
 gfs2_dir_search+0x165/0x220 fs/gfs2/dir.c:1664
 gfs2_lookupi+0x45f/0x640 fs/gfs2/inode.c:323
 gfs2_jindex_hold fs/gfs2/ops_fstype.c:609 [inline]
 init_journal+0x54c/0x2300 fs/gfs2/ops_fstype.c:753
 init_inodes+0xdb/0x320 fs/gfs2/ops_fstype.c:889
 gfs2_fill_super+0x1718/0x1f80 fs/gfs2/ops_fstype.c:1246
 get_tree_bdev+0x3f1/0x610 fs/super.c:1366
 gfs2_get_tree+0x4d/0x1e0 fs/gfs2/ops_fstype.c:1327
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x24a/0xa40 fs/namespace.c:3058
 do_mount fs/namespace.c:3401 [inline]
 __do_sys_mount fs/namespace.c:3609 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3586
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 21:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1750
 slab_free mm/slub.c:3661 [inline]
 kmem_cache_free+0xf7/0x290 mm/slub.c:3683
 rcu_do_batch kernel/rcu/tree.c:2297 [inline]
 rcu_core+0x9c0/0x16a0 kernel/rcu/tree.c:2557
 handle_softirqs+0x2a1/0x920 kernel/softirq.c:596
 run_ksoftirqd+0x98/0xf0 kernel/softirq.c:963
 smpboot_thread_fn+0x64a/0xa40 kernel/smpboot.c:164
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
 call_rcu+0x14b/0x970 kernel/rcu/tree.c:2845
 gfs2_glock_free+0xd3b/0x1090 fs/gfs2/glock.c:178
 gfs2_glock_put_eventually fs/gfs2/super.c:1257 [inline]
 gfs2_evict_inode+0xe85/0x1170 fs/gfs2/super.c:1534
 evict+0x485/0x870 fs/inode.c:705
 gfs2_jindex_free+0x35e/0x400 fs/gfs2/super.c:75
 init_journal+0x8f9/0x2300 fs/gfs2/ops_fstype.c:871
 init_inodes+0xdb/0x320 fs/gfs2/ops_fstype.c:889
 gfs2_fill_super+0x1718/0x1f80 fs/gfs2/ops_fstype.c:1246
 get_tree_bdev+0x3f1/0x610 fs/super.c:1366
 gfs2_get_tree+0x4d/0x1e0 fs/gfs2/ops_fstype.c:1327
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x24a/0xa40 fs/namespace.c:3058
 do_mount fs/namespace.c:3401 [inline]
 __do_sys_mount fs/namespace.c:3609 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3586
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Second to last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
 insert_work+0x54/0x3c0 kernel/workqueue.c:1361
 __queue_work+0xba3/0xfb0 kernel/workqueue.c:1520
 queue_delayed_work_on+0x126/0x1e0 kernel/workqueue.c:1704
 queue_delayed_work include/linux/workqueue.h:527 [inline]
 __gfs2_glock_queue_work fs/gfs2/glock.c:258 [inline]
 gfs2_glock_queue_work fs/gfs2/glock.c:272 [inline]
 do_xmote+0x781/0x13c0 fs/gfs2/glock.c:871
 glock_work_func+0x25e/0x470 fs/gfs2/glock.c:1089
 process_one_work+0x898/0x1160 kernel/workqueue.c:2292
 worker_thread+0xaa2/0x1250 kernel/workqueue.c:2439
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff88802911cfd8
 which belongs to the cache gfs2_glock(aspace) of size 1224
The buggy address is located 1120 bytes inside of
 1224-byte region [ffff88802911cfd8, ffff88802911d4a0)

The buggy address belongs to the physical page:
page:ffffea0000a44700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2911c
head:ffffea0000a44700 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88801b708640
raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4424, tgid 4424 (syz.0.16), ts 83954313098, free_ts 77724211988
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328
 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614
 alloc_slab_page+0x5d/0x160 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x87/0x2c0 mm/slub.c:1992
 ___slab_alloc+0xbc6/0x1220 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x1b7/0x2f0 mm/slub.c:3422
 gfs2_glock_get+0x284/0xe90 fs/gfs2/glock.c:1180
 gfs2_inode_lookup+0x228/0xc80 fs/gfs2/inode.c:135
 gfs2_lookup_root fs/gfs2/ops_fstype.c:462 [inline]
 init_sb+0xa2a/0x1310 fs/gfs2/ops_fstype.c:529
 gfs2_fill_super+0x13fa/0x1f80 fs/gfs2/ops_fstype.c:1213
 get_tree_bdev+0x3f1/0x610 fs/super.c:1366
 gfs2_get_tree+0x4d/0x1e0 fs/gfs2/ops_fstype.c:1327
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x24a/0xa40 fs/namespace.c:3058
 do_mount fs/namespace.c:3401 [inline]
 __do_sys_mount fs/namespace.c:3609 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3586
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384
 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x123/0x2f0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 __kernfs_new_node+0xd4/0x7d0 fs/kernfs/dir.c:614
 kernfs_new_node+0x148/0x250 fs/kernfs/dir.c:690
 __kernfs_create_file+0x47/0x2e0 fs/kernfs/file.c:1050
 sysfs_add_file_mode_ns+0x234/0x2f0 fs/sysfs/file.c:294
 create_files fs/sysfs/group.c:64 [inline]
 internal_create_group+0x487/0xce0 fs/sysfs/group.c:148
 internal_create_groups fs/sysfs/group.c:188 [inline]
 sysfs_create_groups+0x55/0x120 fs/sysfs/group.c:214
 create_dir lib/kobject.c:68 [inline]
 kobject_add_internal+0x6ff/0xc80 lib/kobject.c:231
 kobject_add_varg lib/kobject.c:366 [inline]
 kobject_init_and_add+0x122/0x190 lib/kobject.c:449
 rx_queue_add_kobject net/core/net-sysfs.c:1061 [inline]
 net_rx_queue_update_kobjects+0x1cd/0x4a0 net/core/net-sysfs.c:1112

Memory state around the buggy address:
 ffff88802911d300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802911d380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802911d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff88802911d480: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802911d500: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/09 04:59 linux-6.1.y 04d1ccaa9c28 4d9fdfa4 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-1-kasan KASAN: use-after-free Read in lru_add_fn
* Struck through repros no longer work on HEAD.