syzbot


KASAN: slab-out-of-bounds Write in __internal_add_timer (2)

Status: auto-closed as invalid on 2021/12/05 06:45
Reported-by: syzbot+55a40ef0654a2ff5911d@syzkaller.appspotmail.com
First crash: 1377d, last: 1202d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: slab-out-of-bounds Write in __internal_add_timer 4 1515d 1589d 0/2 auto-closed as invalid on 2021/01/26 06:16
upstream KASAN: slab-out-of-bounds Write in __internal_add_timer 4 2622d 2577d 0/28 closed as invalid on 2017/11/05 08:51
android-54 KASAN: use-after-free Write in __internal_add_timer C 155 660d 1601d 0/2 upstream: reported C repro on 2020/07/04 17:00

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in hlist_add_head include/linux/list.h:787 [inline]
BUG: KASAN: slab-out-of-bounds in enqueue_timer kernel/time/timer.c:541 [inline]
BUG: KASAN: slab-out-of-bounds in __internal_add_timer+0x2a6/0x4a0 kernel/time/timer.c:554
Write of size 8 at addr ffff8881dd7d71c8 by task syz-executor.4/1043

CPU: 1 PID: 1043 Comm: syz-executor.4 Not tainted 5.4.125-syzkaller-00001-g306607c78507 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x24e lib/dump_stack.c:118
 print_address_description+0x9b/0x650 mm/kasan/report.c:384
 __kasan_report+0x182/0x260 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 hlist_add_head include/linux/list.h:787 [inline]
 enqueue_timer kernel/time/timer.c:541 [inline]
 __internal_add_timer+0x2a6/0x4a0 kernel/time/timer.c:554
 internal_add_timer kernel/time/timer.c:604 [inline]
 __mod_timer+0xab9/0x1c70 kernel/time/timer.c:1065
 sk_reset_timer+0x1e/0x50 net/core/sock.c:2862
 inet_csk_reset_xmit_timer include/net/inet_connection_sock.h:242 [inline]
 tcp_connect+0x1696/0x23d0 net/ipv4/tcp_output.c:3628
 tcp_v4_connect+0x11bf/0x1c80 net/ipv4/tcp_ipv4.c:313
 __inet_stream_connect+0x9ef/0xd80 net/ipv4/af_inet.c:659
 tcp_sendmsg_fastopen net/ipv4/tcp.c:1176 [inline]
 tcp_sendmsg_locked+0x3aa1/0x4080 net/ipv4/tcp.c:1218
 tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1445
 sock_sendmsg_nosec net/socket.c:638 [inline]
 sock_sendmsg net/socket.c:658 [inline]
 __sys_sendto+0x4f1/0x6c0 net/socket.c:1953
 __do_sys_sendto net/socket.c:1965 [inline]
 __se_sys_sendto net/socket.c:1961 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:1961
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x4665e9
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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f32ed1c6188 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 00000000004bfcc4 R08: 0000000020000080 R09: 0000000000000010
R10: 0000000022040fb5 R11: 0000000000000246 R12: 000000000056bf80
R13: 00007ffe0c0652ef R14: 00007f32ed1c6300 R15: 0000000000022000

Allocated by task 985:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:529
 __kmalloc+0x174/0x2f0 mm/slub.c:3903
 kmalloc_array+0x2d/0x40 include/linux/slab.h:619
 kcalloc include/linux/slab.h:629 [inline]
 iter_file_splice_write+0x227/0xf20 fs/splice.c:690
 splice_direct_to_actor+0x4b4/0xb30 fs/splice.c:976
 do_splice_direct+0x28b/0x3e0 fs/splice.c:1064
 do_sendfile+0x8e4/0x1140 fs/read_write.c:1464
 __do_sys_sendfile64 fs/read_write.c:1525 [inline]
 __se_sys_sendfile64 fs/read_write.c:1511 [inline]
 __x64_sys_sendfile64+0x1c4/0x220 fs/read_write.c:1511
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 985:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 kasan_set_free_info mm/kasan/common.c:345 [inline]
 __kasan_slab_free+0x18a/0x240 mm/kasan/common.c:487
 slab_free_hook mm/slub.c:1454 [inline]
 slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1492
 slab_free mm/slub.c:3072 [inline]
 kfree+0xe0/0x660 mm/slub.c:4061
 iter_file_splice_write+0xcef/0xf20 fs/splice.c:773
 splice_direct_to_actor+0x4b4/0xb30 fs/splice.c:976
 do_splice_direct+0x28b/0x3e0 fs/splice.c:1064
 do_sendfile+0x8e4/0x1140 fs/read_write.c:1464
 __do_sys_sendfile64 fs/read_write.c:1525 [inline]
 __se_sys_sendfile64 fs/read_write.c:1511 [inline]
 __x64_sys_sendfile64+0x1c4/0x220 fs/read_write.c:1511
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881dd7d7000
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 200 bytes to the right of
 256-byte region [ffff8881dd7d7000, ffff8881dd7d7100)
The buggy address belongs to the page:
page:ffffea000775f580 refcount:1 mapcount:0 mapping:ffff8881f5c02780 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c02780
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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x19a/0x380 mm/page_alloc.c:2171
 get_page_from_freelist+0x550/0x8b0 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x3a2/0x880 mm/page_alloc.c:4855
 alloc_slab_page+0x39/0x3e0 mm/slub.c:342
 allocate_slab mm/slub.c:1675 [inline]
 new_slab+0x97/0x460 mm/slub.c:1741
 new_slab_objects mm/slub.c:2498 [inline]
 ___slab_alloc+0x330/0x4c0 mm/slub.c:2659
 __slab_alloc mm/slub.c:2699 [inline]
 slab_alloc_node mm/slub.c:2784 [inline]
 slab_alloc mm/slub.c:2829 [inline]
 __kmalloc+0x1ee/0x2f0 mm/slub.c:3899
 kmalloc_array+0x2d/0x40 include/linux/slab.h:619
 kcalloc include/linux/slab.h:629 [inline]
 iter_file_splice_write+0x227/0xf20 fs/splice.c:690
 splice_direct_to_actor+0x4b4/0xb30 fs/splice.c:976
 do_splice_direct+0x28b/0x3e0 fs/splice.c:1064
 do_sendfile+0x8e4/0x1140 fs/read_write.c:1464
 __do_sys_sendfile64 fs/read_write.c:1525 [inline]
 __se_sys_sendfile64 fs/read_write.c:1511 [inline]
 __x64_sys_sendfile64+0x1c4/0x220 fs/read_write.c:1511
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1176 [inline]
 __free_pages_ok+0xc60/0xd80 mm/page_alloc.c:1438
 free_the_page mm/page_alloc.c:4917 [inline]
 __free_pages+0x8f/0x250 mm/page_alloc.c:4923
 kfree+0x1ee/0x660 mm/slub.c:4058
 device_release+0x70/0x1a0 drivers/base/core.c:1776
 kobject_cleanup+0x1de/0x3c0 lib/kobject.c:708
 tun_set_iff drivers/net/tun.c:2900 [inline]
 __tun_chr_ioctl+0x2b91/0x4d20 drivers/net/tun.c:3143
 do_vfs_ioctl+0x76a/0x1720 fs/ioctl.c:47
 ksys_ioctl fs/ioctl.c:742 [inline]
 __do_sys_ioctl fs/ioctl.c:749 [inline]
 __se_sys_ioctl fs/ioctl.c:747 [inline]
 __x64_sys_ioctl+0xd4/0x110 fs/ioctl.c:747
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Memory state around the buggy address:
 ffff8881dd7d7080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881dd7d7100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881dd7d7180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                              ^
 ffff8881dd7d7200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881dd7d7280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/08/07 06:44 android12-5.4 306607c78507 6972b106 .config console log report info ci2-android-5-4-kasan KASAN: slab-out-of-bounds Write in __internal_add_timer
2021/04/08 00:43 android12-5.4 46c5fdececa6 6a81331a .config console log report info ci2-android-5-4-kasan KASAN: slab-out-of-bounds Write in __internal_add_timer
2021/02/13 02:55 android12-5.4 57b3f4830fb6 98682e5e .config console log report info ci2-android-5-4-kasan KASAN: slab-out-of-bounds Write in __internal_add_timer
2021/07/08 14:30 android12-5.4 a57aec00e1ca 1aade754 .config console log report info ci2-android-5-4-kasan KASAN: out-of-bounds Write in __internal_add_timer
* Struck through repros no longer work on HEAD.