syzbot


KASAN: use-after-free Read in diAlloc

Status: upstream: reported C repro on 2022/10/03 09:45
Reported-by: syzbot+04643c5bca6163c7ac34@syzkaller.appspotmail.com
First crash: 734d, last: 588d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in diAlloc C error 3 689d 734d 0/1 upstream: reported C repro on 2022/10/02 23:41
linux-5.15 UBSAN: array-index-out-of-bounds in diAlloc 3 313d 313d 0/3 auto-obsoleted due to no activity on 2024/03/07 05:11
upstream UBSAN: array-index-out-of-bounds in diAlloc jfs C error inconclusive 37 330d 740d 25/28 fixed on 2023/12/21 03:45
linux-6.1 UBSAN: array-index-out-of-bounds in diAlloc 4 313d 331d 0/3 auto-obsoleted due to no activity on 2024/03/07 03:48
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2023/02/25 21:24 25m bisect fix linux-4.14.y OK (0) job log log
2023/01/25 11:35 23m bisect fix linux-4.14.y OK (0) job log log
2022/11/13 20:49 26m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:185 [inline]
BUG: KASAN: use-after-free in atomic_read arch/x86/include/asm/atomic.h:27 [inline]
BUG: KASAN: use-after-free in diAlloc+0xe7e/0x1230 fs/jfs/jfs_imap.c:1380
Read of size 4 at addr ffff8880b305e90c by task syz-executor178/7979

CPU: 0 PID: 7979 Comm: syz-executor178 Not tainted 4.14.295-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
 __read_once_size include/linux/compiler.h:185 [inline]
 atomic_read arch/x86/include/asm/atomic.h:27 [inline]
 diAlloc+0xe7e/0x1230 fs/jfs/jfs_imap.c:1380
 ialloc+0x7b/0x940 fs/jfs/jfs_inode.c:70
 jfs_create.part.0+0xf7/0x800 fs/jfs/namei.c:105
 jfs_create+0x35/0x50 fs/jfs/namei.c:90
 lookup_open+0x77a/0x1750 fs/namei.c:3241
 do_last fs/namei.c:3334 [inline]
 path_openat+0xe08/0x2970 fs/namei.c:3571
 do_filp_open+0x179/0x3c0 fs/namei.c:3605
 do_sys_open+0x296/0x410 fs/open.c:1081
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f04dea49eb9
RSP: 002b:00007ffdbf2222c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f04dea49eb9
RDX: 0000000000000000 RSI: 0000000000141042 RDI: 0000000020000200
RBP: 00007f04dea09720 R08: 00005555572832c0 R09: 0000000000000000
R10: 00007ffdbf222190 R11: 0000000000000246 R12: 0000000200000004
R13: 0000000000000000 R14: 00080000000000f8 R15: 0000000000000000

Allocated by task 6249:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 skb_clone+0x126/0x9a0 net/core/skbuff.c:1291
 do_one_broadcast net/netlink/af_netlink.c:1421 [inline]
 netlink_broadcast_filtered+0x815/0x9e0 net/netlink/af_netlink.c:1496
 netlink_broadcast net/netlink/af_netlink.c:1520 [inline]
 netlink_sendmsg+0x9fd/0xbc0 net/netlink/af_netlink.c:1891
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:656
 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
 __sys_sendmsg+0xa3/0x120 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2103
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6249:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 kfree_skbmem+0x98/0x100 net/core/skbuff.c:595
 __kfree_skb net/core/skbuff.c:655 [inline]
 kfree_skb+0xf4/0x390 net/core/skbuff.c:672
 do_one_broadcast net/netlink/af_netlink.c:1445 [inline]
 netlink_broadcast_filtered+0x575/0x9e0 net/netlink/af_netlink.c:1496
 netlink_broadcast net/netlink/af_netlink.c:1520 [inline]
 netlink_sendmsg+0x9fd/0xbc0 net/netlink/af_netlink.c:1891
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:656
 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
 __sys_sendmsg+0xa3/0x120 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2103
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880b305e8c0
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 76 bytes inside of
 232-byte region [ffff8880b305e8c0, ffff8880b305e9a8)
The buggy address belongs to the page:
page:ffffea0002cc1780 count:1 mapcount:0 mapping:ffff8880b305e000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b305e000 0000000000000000 000000010000000c
raw: ffffea00026e78a0 ffffea00026ed360 ffff8880b5538900 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b305e800: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
 ffff8880b305e880: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8880b305e900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8880b305e980: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
 ffff8880b305ea00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/10/03 09:45 linux-4.14.y 9d5c0b3a8e1a feb56351 .config console log report syz C [disk image] [vmlinux] ci2-linux-4-14 KASAN: use-after-free Read in diAlloc
2022/10/14 20:48 linux-4.14.y 9d5c0b3a8e1a 4954e4b2 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-14 BUG: unable to handle kernel paging request in diAlloc
* Struck through repros no longer work on HEAD.