syzbot


KASAN: use-after-free Read in gfs2_glock_free

Status: auto-obsoleted due to no activity on 2023/05/19 07:29
Subsystems: gfs2
[Documentation on labels]
Reported-by: syzbot+4ef8215f36f852e6c1e7@syzkaller.appspotmail.com
First crash: 379d, last: 379d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3ee7/0x56d0 kernel/locking/lockdep.c:4925
Read of size 8 at addr ffff88802baf0518 by task kworker/1:1H/51

CPU: 1 PID: 51 Comm: kworker/1:1H Not tainted 6.2.0-rc8-syzkaller-00127-gdbeed98d89ea #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Workqueue: glock_workqueue glock_work_func
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:306 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:417
 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
 __lock_acquire+0x3ee7/0x56d0 kernel/locking/lockdep.c:4925
 lock_acquire kernel/locking/lockdep.c:5668 [inline]
 lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
 __wake_up_common_lock+0xb8/0x140 kernel/sched/wait.c:137
 gfs2_glock_free+0x9d9/0x1020 fs/gfs2/glock.c:180
 glock_work_func+0x2d1/0x3b0 fs/gfs2/glock.c:1072
 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
 worker_thread+0x669/0x1090 kernel/workqueue.c:2436
 kthread+0x2e8/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Allocated by task 8132:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 ____kasan_kmalloc mm/kasan/common.c:333 [inline]
 __kasan_kmalloc+0xa5/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:580 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 init_sbd fs/gfs2/ops_fstype.c:77 [inline]
 gfs2_fill_super+0x125/0x27a0 fs/gfs2/ops_fstype.c:1149
 get_tree_bdev+0x444/0x760 fs/super.c:1282
 gfs2_get_tree+0x4e/0x270 fs/gfs2/ops_fstype.c:1330
 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489
 do_new_mount fs/namespace.c:3145 [inline]
 path_mount+0x132a/0x1e20 fs/namespace.c:3475
 do_mount fs/namespace.c:3488 [inline]
 __do_sys_mount fs/namespace.c:3697 [inline]
 __se_sys_mount fs/namespace.c:3674 [inline]
 __x64_sys_mount+0x283/0x300 fs/namespace.c:3674
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 5114:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:523
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
 slab_free mm/slub.c:3787 [inline]
 __kmem_cache_free+0xaf/0x3b0 mm/slub.c:3800
 generic_shutdown_super+0x158/0x410 fs/super.c:492
 kill_block_super+0x9b/0xf0 fs/super.c:1386
 gfs2_kill_sb+0x108/0x170 fs/gfs2/ops_fstype.c:1738
 deactivate_locked_super+0x98/0x160 fs/super.c:332
 deactivate_super+0xb1/0xd0 fs/super.c:363
 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1291
 task_work_run+0x16f/0x270 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:203
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296
 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88802baf0000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 1304 bytes inside of
 8192-byte region [ffff88802baf0000, ffff88802baf2000)

The buggy address belongs to the physical page:
page:ffffea0000aebc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2baf0
head:ffffea0000aebc00 order:3 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0
anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff888012442280 ffffea0001097a00 0000000000000005
raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 7947, tgid 7946 (syz-executor.1), ts 324627967742, free_ts 324453142333
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2287
 alloc_slab_page mm/slub.c:1851 [inline]
 allocate_slab+0x25f/0x350 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3193
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 __kmem_cache_alloc_node+0x1a4/0x430 mm/slub.c:3491
 kmalloc_trace+0x26/0x60 mm/slab_common.c:1062
 kmalloc include/linux/slab.h:580 [inline]
 audit_log_d_path+0xd2/0x1e0 kernel/audit.c:2134
 audit_log_d_path_exe+0x44/0x70 kernel/audit.c:2205
 audit_log_task+0x273/0x300 kernel/auditsc.c:2949
 audit_seccomp+0x7a/0x290 kernel/auditsc.c:2996
 seccomp_log kernel/seccomp.c:994 [inline]
 __seccomp_filter+0x81c/0x1080 kernel/seccomp.c:1280
 __secure_computing+0x24a/0x3e0 kernel/seccomp.c:1342
 syscall_trace_enter.constprop.0+0x90/0x250 kernel/entry/common.c:72
 do_syscall_64+0x1a/0xb0 arch/x86/entry/common.c:76
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1446 [inline]
 free_pcp_prepare+0x66a/0xc20 mm/page_alloc.c:1496
 free_unref_page_prepare mm/page_alloc.c:3369 [inline]
 free_unref_page+0x1d/0x490 mm/page_alloc.c:3464
 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2637
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slab.h:761 [inline]
 slab_alloc_node mm/slub.c:3452 [inline]
 __kmem_cache_alloc_node+0x1ea/0x430 mm/slub.c:3491
 kmalloc_trace+0x26/0x60 mm/slab_common.c:1062
 kmalloc include/linux/slab.h:580 [inline]
 gro_cells_destroy net/core/gro_cells.c:125 [inline]
 gro_cells_destroy+0x26b/0x470 net/core/gro_cells.c:105
 ip6_dev_free+0x19/0x60 net/ipv6/ip6_tunnel.c:248
 netdev_run_todo+0x6bf/0x1100 net/core/dev.c:10344
 ip6_tnl_exit_batch_net+0x5fe/0x890 net/ipv6/ip6_tunnel.c:2279
 ops_exit_list+0x125/0x170 net/core/net_namespace.c:174
 setup_net+0x7fb/0xc50 net/core/net_namespace.c:361
 copy_net_ns+0x4e9/0x8d0 net/core/net_namespace.c:490
 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110

Memory state around the buggy address:
 ffff88802baf0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802baf0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802baf0500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88802baf0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802baf0600: fb fb fb fb fb 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
2023/02/18 07:28 upstream dbeed98d89ea d02e9a70 .config console log report info ci-upstream-kasan-gce-root KASAN: use-after-free Read in gfs2_glock_free
* Struck through repros no longer work on HEAD.