syzbot


KASAN: use-after-free Write in diWrite

Status: upstream: reported on 2024/09/20 20:20
Reported-by: syzbot+32799a32790e9973dc5b@syzkaller.appspotmail.com
First crash: 15d, last: 15d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Write in diWrite jfs C inconclusive 13 14d 163d 0/28 upstream: reported C repro on 2024/04/25 21:10
linux-4.19 KASAN: use-after-free Write in diWrite syz error 2 717d 717d 0/1 upstream: reported syz repro on 2022/10/19 03:08
upstream UBSAN: array-index-out-of-bounds in diWrite jfs C error done 13 295d 715d 25/28 fixed on 2024/01/30 15:47

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in diWrite+0xb48/0x1604 fs/jfs/jfs_imap.c:753
Write of size 32 at addr ffff0000d18b52e0 by task syz.3.463/6565

CPU: 1 PID: 6565 Comm: syz.3.463 Not tainted 5.15.167-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 kasan_check_range+0x274/0x2b4 mm/kasan/generic.c:189
 memcpy+0xb4/0xe8 mm/kasan/shadow.c:66
 diWrite+0xb48/0x1604 fs/jfs/jfs_imap.c:753
 txCommit+0x754/0x55b0 fs/jfs/jfs_txnmgr.c:1255
 jfs_create+0x828/0xa1c fs/jfs/namei.c:156
 lookup_open fs/namei.c:3462 [inline]
 open_last_lookups fs/namei.c:3532 [inline]
 path_openat+0xf18/0x26cc fs/namei.c:3739
 do_filp_open+0x1a8/0x3b4 fs/namei.c:3769
 do_sys_openat2+0x128/0x3e0 fs/open.c:1253
 do_sys_open fs/open.c:1269 [inline]
 __do_sys_openat fs/open.c:1285 [inline]
 __se_sys_openat fs/open.c:1280 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1280
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 4071:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8c/0xcc mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 kmem_cache_alloc_node+0x208/0x49c mm/slub.c:3256
 __alloc_skb+0x174/0x584 net/core/skbuff.c:415
 alloc_skb include/linux/skbuff.h:1167 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:664 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:721 [inline]
 nsim_dev_trap_report_work+0x1e4/0x90c drivers/net/netdevsim/dev.c:762
 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
 worker_thread+0x910/0x1034 kernel/workqueue.c:2457
 kthread+0x37c/0x45c kernel/kthread.c:334
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Freed by task 4071:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515
 kfree_skbmem+0x114/0x1b0
 __kfree_skb net/core/skbuff.c:757 [inline]
 consume_skb+0x140/0x40c net/core/skbuff.c:914
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:737 [inline]
 nsim_dev_trap_report_work+0x618/0x90c drivers/net/netdevsim/dev.c:762
 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
 worker_thread+0x910/0x1034 kernel/workqueue.c:2457
 kthread+0x37c/0x45c kernel/kthread.c:334
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

The buggy address belongs to the object at ffff0000d18b5280
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 96 bytes inside of
 232-byte region [ffff0000d18b5280, ffff0000d18b5368)
The buggy address belongs to the page:
page:00000000fd0c3923 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1118b5
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc0003561f80 0000000400000002 ffff0000c086a000
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d18b5180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d18b5200: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d18b5280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff0000d18b5300: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
 ffff0000d18b5380: fc fc fc fc fc fc fc fc 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
2024/09/20 20:19 linux-5.15.y 3a5928702e71 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in diWrite
* Struck through repros no longer work on HEAD.