syzbot


KASAN: use-after-free Read in udf_free_blocks

Status: auto-obsoleted due to no activity on 2023/04/05 10:54
Subsystems: udf
[Documentation on labels]
Reported-by: syzbot+06c3a17d0837c23f2715@syzkaller.appspotmail.com
First crash: 721d, last: 721d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in udf_free_blocks udf C done done 2 355d 565d 25/28 fixed on 2024/03/20 11:33

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in udf_free_blocks+0x203/0x240 fs/udf/balloc.c:658
Read of size 2 at addr ffff888078b54572 by task syz-executor.3/5537

CPU: 0 PID: 5537 Comm: syz-executor.3 Not tainted 6.2.0-rc2-syzkaller-00024-g512dee0c00ad #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1b1/0x290 lib/dump_stack.c:106
 print_address_description+0x74/0x340 mm/kasan/report.c:306
 print_report+0x107/0x1f0 mm/kasan/report.c:417
 kasan_report+0xcd/0x100 mm/kasan/report.c:517
 udf_free_blocks+0x203/0x240 fs/udf/balloc.c:658
 udf_merge_extents fs/udf/inode.c:1150 [inline]
 inode_getblk fs/udf/inode.c:876 [inline]
 udf_get_block+0x3186/0x5130 fs/udf/inode.c:444
 __block_write_begin_int+0x54c/0x1a80 fs/buffer.c:1991
 __block_write_begin fs/buffer.c:2041 [inline]
 block_write_begin+0x93/0x1e0 fs/buffer.c:2102
 udf_write_begin+0x2d/0x60 fs/udf/inode.c:207
 generic_perform_write+0x2e4/0x5e0 mm/filemap.c:3772
 __generic_file_write_iter+0x29b/0x400 mm/filemap.c:3868
 udf_file_write_iter+0x325/0x5f0 fs/udf/file.c:170
 do_iter_write+0x6c2/0xc20 fs/read_write.c:861
 vfs_writev fs/read_write.c:934 [inline]
 do_pwritev+0x200/0x350 fs/read_write.c:1031
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fbf1a68c0c9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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:00007fbf1b321168 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007fbf1a7abf80 RCX: 00007fbf1a68c0c9
RDX: 0000000000000001 RSI: 0000000020000680 RDI: 0000000000000006
RBP: 00007fbf1a6e7ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffee500a44f R14: 00007fbf1b321300 R15: 0000000000022000
 </TASK>

Allocated by task 5159:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x3d/0x60 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:380
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:968 [inline]
 __kmalloc_node_track_caller+0xad/0x190 mm/slab_common.c:988
 kmalloc_reserve net/core/skbuff.c:492 [inline]
 __alloc_skb+0x12c/0x2c0 net/core/skbuff.c:565
 alloc_skb include/linux/skbuff.h:1270 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:751 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:808 [inline]
 nsim_dev_trap_report_work+0x268/0xaa0 drivers/net/netdevsim/dev.c:853
 process_one_work+0x877/0xdb0 kernel/workqueue.c:2289
 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436
 kthread+0x266/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Freed by task 5159:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x3d/0x60 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:518
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1807
 slab_free mm/slub.c:3787 [inline]
 __kmem_cache_free+0x71/0x110 mm/slub.c:3800
 skb_free_head net/core/skbuff.c:822 [inline]
 skb_release_data+0x4f6/0x710 net/core/skbuff.c:851
 skb_release_all net/core/skbuff.c:916 [inline]
 __kfree_skb+0x5b/0x1d0 net/core/skbuff.c:930
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:824 [inline]
 nsim_dev_trap_report_work+0x767/0xaa0 drivers/net/netdevsim/dev.c:853
 process_one_work+0x877/0xdb0 kernel/workqueue.c:2289
 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436
 kthread+0x266/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

The buggy address belongs to the object at ffff888078b54000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 1394 bytes inside of
 4096-byte region [ffff888078b54000, ffff888078b55000)

The buggy address belongs to the physical page:
page:ffffea0001e2d400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x78b50
head:ffffea0001e2d400 order:3 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0
anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff888012842140 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000040004 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 0xd2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5112, tgid 5112 (syz-executor.2), ts 181694561807, free_ts 180861593054
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x742/0x7c0 mm/page_alloc.c:4283
 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549
 alloc_slab_page+0xbd/0x190 mm/slub.c:1851
 allocate_slab+0x5e/0x3c0 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0x782/0xe20 mm/slub.c:3193
 __slab_alloc mm/slub.c:3292 [inline]
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 __kmem_cache_alloc_node+0x25b/0x340 mm/slub.c:3491
 __do_kmalloc_node mm/slab_common.c:967 [inline]
 __kmalloc_node_track_caller+0x9c/0x190 mm/slab_common.c:988
 kmalloc_reserve net/core/skbuff.c:492 [inline]
 __alloc_skb+0x12c/0x2c0 net/core/skbuff.c:565
 alloc_skb include/linux/skbuff.h:1270 [inline]
 nlmsg_new include/net/netlink.h:1002 [inline]
 rtmsg_ifinfo_build_skb+0x81/0x1a0 net/core/rtnetlink.c:3948
 rtmsg_ifinfo_event net/core/rtnetlink.c:3986 [inline]
 rtmsg_ifinfo+0xc5/0x200 net/core/rtnetlink.c:3995
 __dev_notify_flags+0xf9/0x5e0 net/core/dev.c:8565
 dev_change_flags+0xe8/0x190 net/core/dev.c:8607
 do_setlink+0xef5/0x3d40 net/core/rtnetlink.c:2827
 __rtnl_newlink net/core/rtnetlink.c:3590 [inline]
 rtnl_newlink+0x1780/0x2020 net/core/rtnetlink.c:3637
 rtnetlink_rcv_msg+0x822/0xf10 net/core/rtnetlink.c:6141
 netlink_rcv_skb+0x1f0/0x470 net/netlink/af_netlink.c:2564
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+0x751/0x780 mm/page_alloc.c:1496
 free_unref_page_prepare mm/page_alloc.c:3369 [inline]
 free_unref_page+0x19/0x4c0 mm/page_alloc.c:3464
 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:302
 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+0x1e0/0x340 mm/slub.c:3491
 kmalloc_trace+0x26/0x60 mm/slab_common.c:1062
 kmalloc include/linux/slab.h:580 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 inet_alloc_ifa net/ipv4/devinet.c:221 [inline]
 inetdev_event+0x8d1/0x1500 net/ipv4/devinet.c:1559
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0xe7/0x170 kernel/notifier.c:455
 __dev_notify_flags+0x308/0x5e0
 dev_change_flags+0xe8/0x190 net/core/dev.c:8607
 do_setlink+0xef5/0x3d40 net/core/rtnetlink.c:2827
 __rtnl_newlink net/core/rtnetlink.c:3590 [inline]
 rtnl_newlink+0x1780/0x2020 net/core/rtnetlink.c:3637
 rtnetlink_rcv_msg+0x822/0xf10 net/core/rtnetlink.c:6141
 netlink_rcv_skb+0x1f0/0x470 net/netlink/af_netlink.c:2564
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x7e7/0x9c0 net/netlink/af_netlink.c:1356

Memory state around the buggy address:
 ffff888078b54400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888078b54480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888078b54500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff888078b54580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888078b54600: 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/01/05 10:54 upstream 512dee0c00ad 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in udf_free_blocks
* Struck through repros no longer work on HEAD.