syzbot


KASAN: slab-out-of-bounds Read in search_by_key

Status: auto-closed as invalid on 2022/06/23 17:15
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+f6cb857b38efeb27bb85@syzkaller.appspotmail.com
First crash: 763d, last: 763d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in search_by_key (2) reiserfs C 4435 108d 540d 26/26 fixed on 2024/01/30 15:47

Sample crash report:
BFS-fs: bfs_fill_super(): loop2 is unclean, continuing
==================================================================
BUG: KASAN: slab-out-of-bounds in search_by_key+0x149/0x4600 fs/reiserfs/stree.c:632
Read of size 8 at addr ffff88801d8cc1f0 by task syz-executor.2/17598

CPU: 1 PID: 17598 Comm: syz-executor.2 Tainted: G        W         5.17.0-syzkaller-09727-g34af78c4e616 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106
 print_address_description+0x64/0x400 mm/kasan/report.c:247
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x19a/0x1f0 mm/kasan/report.c:451
 search_by_key+0x149/0x4600 fs/reiserfs/stree.c:632
 search_by_entry_key+0x32/0x1360 fs/reiserfs/namei.c:125
 reiserfs_readdir_inode+0x29a/0x1400 fs/reiserfs/dir.c:98
 iterate_dir+0x2aa/0x640
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x1ea/0x4e0 fs/readdir.c:354
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7ff511689049
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff51279d168 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 00007ff51179bf60 RCX: 00007ff511689049
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005
RBP: 00007ff5116e308d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdfc6057bf R14: 00007ff51279d300 R15: 0000000000022000
 </TASK>

Allocated by task 17598:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:515
 kasan_kmalloc include/linux/kasan.h:249 [inline]
 kmem_cache_alloc_trace+0x9d/0x330 mm/slub.c:3258
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:714 [inline]
 bfs_fill_super+0x59/0xe20 fs/bfs/inode.c:321
 mount_bdev+0x26c/0x3a0 fs/super.c:1367
 legacy_get_tree+0xea/0x180 fs/fs_context.c:610
 vfs_get_tree+0x86/0x270 fs/super.c:1497
 do_new_mount fs/namespace.c:3039 [inline]
 path_mount+0x1986/0x2c30 fs/namespace.c:3369
 do_mount fs/namespace.c:3382 [inline]
 __do_sys_mount fs/namespace.c:3590 [inline]
 __se_sys_mount+0x308/0x3c0 fs/namespace.c:3567
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:348
 kvfree_call_rcu+0x119/0x880 kernel/rcu/tree.c:3595
 drop_sysctl_table+0x2cd/0x400 fs/proc/proc_sysctl.c:1705
 unregister_sysctl_table+0x86/0x130 fs/proc/proc_sysctl.c:1743
 mptcp_pernet_del_table net/mptcp/ctrl.c:151 [inline]
 mptcp_net_exit+0x59/0x70 net/mptcp/ctrl.c:181
 ops_exit_list net/core/net_namespace.c:162 [inline]
 cleanup_net+0x758/0xc70 net/core/net_namespace.c:594
 process_one_work+0x83c/0x11a0 kernel/workqueue.c:2289
 worker_thread+0xa6c/0x1290 kernel/workqueue.c:2436
 kthread+0x2a3/0x2d0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:348
 kvfree_call_rcu+0x119/0x880 kernel/rcu/tree.c:3595
 drop_sysctl_table+0x2cd/0x400 fs/proc/proc_sysctl.c:1705
 drop_sysctl_table+0x2eb/0x400 fs/proc/proc_sysctl.c:1708
 unregister_sysctl_table+0x86/0x130 fs/proc/proc_sysctl.c:1743
 __devinet_sysctl_unregister net/ipv4/devinet.c:2611 [inline]
 devinet_sysctl_unregister net/ipv4/devinet.c:2639 [inline]
 inetdev_destroy net/ipv4/devinet.c:327 [inline]
 inetdev_event+0x71d/0x1410 net/ipv4/devinet.c:1604
 notifier_call_chain kernel/notifier.c:84 [inline]
 raw_notifier_call_chain+0xe7/0x170 kernel/notifier.c:392
 call_netdevice_notifiers_info net/core/dev.c:1938 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:1976 [inline]
 call_netdevice_notifiers net/core/dev.c:1990 [inline]
 unregister_netdevice_many+0xefe/0x1960 net/core/dev.c:10741
 sit_exit_batch_net+0x495/0x4e0 net/ipv6/sit.c:1950
 ops_exit_list net/core/net_namespace.c:167 [inline]
 cleanup_net+0x80c/0xc70 net/core/net_namespace.c:594
 process_one_work+0x83c/0x11a0 kernel/workqueue.c:2289
 worker_thread+0xa6c/0x1290 kernel/workqueue.c:2436
 kthread+0x2a3/0x2d0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30

The buggy address belongs to the object at ffff88801d8cc000
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 240 bytes to the right of
 256-byte region [ffff88801d8cc000, ffff88801d8cc100)
The buggy address belongs to the page:
page:ffffea0000763300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1d8cc
head:ffffea0000763300 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00007a0a80 dead000000000002 ffff888011441b40
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 8140, ts 334057080160, free_ts 296363084026
 prep_new_page mm/page_alloc.c:2382 [inline]
 get_page_from_freelist+0x708/0xa80 mm/page_alloc.c:4123
 __alloc_pages+0x255/0x580 mm/page_alloc.c:5349
 alloc_slab_page+0x70/0xf0 mm/slub.c:1799
 allocate_slab+0x5d/0x380 mm/slub.c:1944
 new_slab mm/slub.c:2004 [inline]
 ___slab_alloc+0x40e/0xcc0 mm/slub.c:3005
 __slab_alloc mm/slub.c:3092 [inline]
 slab_alloc_node mm/slub.c:3183 [inline]
 slab_alloc mm/slub.c:3225 [inline]
 kmem_cache_alloc_trace+0x28c/0x330 mm/slub.c:3256
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:714 [inline]
 smk_fetch security/smack/smack_lsm.c:290 [inline]
 smack_d_instantiate+0x65d/0xd10 security/smack/smack_lsm.c:3416
 security_d_instantiate+0xa5/0x100 security/security.c:2056
 d_instantiate+0x51/0x90 fs/dcache.c:2034
 shmem_mknod+0x165/0x1b0 mm/shmem.c:2828
 lookup_open fs/namei.c:3330 [inline]
 open_last_lookups fs/namei.c:3400 [inline]
 path_openat+0x12ec/0x36a0 fs/namei.c:3606
 do_filp_open+0x277/0x4f0 fs/namei.c:3636
 do_sys_openat2+0x13b/0x500 fs/open.c:1214
 do_sys_open fs/open.c:1230 [inline]
 __do_sys_openat fs/open.c:1246 [inline]
 __se_sys_openat fs/open.c:1241 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1241
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1348 [inline]
 free_pcp_prepare+0xcbd/0xec0 mm/page_alloc.c:1400
 free_unref_page_prepare mm/page_alloc.c:3269 [inline]
 free_unref_page+0x7d/0x580 mm/page_alloc.c:3364
 __vunmap+0x8cd/0xa90 mm/vmalloc.c:2656
 do_free_pages sound/core/pcm_memory.c:65 [inline]
 snd_pcm_lib_free_pages+0x1f1/0x2b0 sound/core/pcm_memory.c:466
 do_hw_free sound/core/pcm_native.c:856 [inline]
 snd_pcm_release_substream+0x489/0x6d0 sound/core/pcm_native.c:2679
 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2413 [inline]
 snd_pcm_oss_release+0x1a3/0x270 sound/core/oss/pcm_oss.c:2592
 __fput+0x3fc/0x870 fs/file_table.c:317
 task_work_run+0x146/0x1c0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:190 [inline]
 exit_to_user_mode_prepare+0x1dd/0x200 kernel/entry/common.c:222
 __syscall_exit_to_user_mode_work kernel/entry/common.c:304 [inline]
 syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:315
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff88801d8cc080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88801d8cc100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801d8cc180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                             ^
 ffff88801d8cc200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88801d8cc280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/03/25 17:14 upstream 34af78c4e616 89bc8608 .config console log report info ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in search_by_key
* Struck through repros no longer work on HEAD.