syzbot


KASAN: slab-out-of-bounds Read in crypto_shash_update

Status: upstream: reported on 2024/07/06 02:06
Reported-by: syzbot+aabc722202ec11ea4f7b@syzkaller.appspotmail.com
First crash: 63d, last: 63d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: slab-out-of-bounds Read in crypto_shash_update 6 64d 74d 0/3 upstream: reported on 2024/06/25 09:22
upstream BUG: unable to handle kernel paging request in crypto_shash_update crypto C 4 28d 53d 0/27 upstream: reported C repro on 2024/07/16 01:23

Sample crash report:
XFS (loop3): invalid iclog size (1 bytes), using lsunit (65536 bytes)
==================================================================
BUG: KASAN: slab-out-of-bounds in crc32c_intel_le_hw arch/x86/crypto/crc32c-intel_glue.c:67 [inline]
BUG: KASAN: slab-out-of-bounds in crc32c_pcl_intel_update+0x120/0x270 arch/x86/crypto/crc32c-intel_glue.c:165
Read of size 8 at addr ffff88805ea7be00 by task syz.3.307/4708

CPU: 1 PID: 4708 Comm: syz.3.307 Not tainted 6.1.97-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 crc32c_intel_le_hw arch/x86/crypto/crc32c-intel_glue.c:67 [inline]
 crc32c_pcl_intel_update+0x120/0x270 arch/x86/crypto/crc32c-intel_glue.c:165
 crypto_shash_update+0x1db/0x2a0 crypto/shash.c:131
 crc32c+0xeb/0x1b0 lib/libcrc32c.c:47
 xlog_cksum+0xe6/0x150 fs/xfs/xfs_log.c:1842
 xlog_recover_process+0x83/0x2e0 fs/xfs/xfs_log_recover.c:2858
 xlog_do_recovery_pass+0x8f3/0xec0 fs/xfs/xfs_log_recover.c:3186
 xlog_verify_head+0x21b/0x5a0 fs/xfs/xfs_log_recover.c:1058
 xlog_find_tail+0x9d8/0xf80 fs/xfs/xfs_log_recover.c:1319
 xlog_recover+0xd9/0x560 fs/xfs/xfs_log_recover.c:3361
 xfs_log_mount+0x3d1/0x700 fs/xfs/xfs_log.c:733
 xfs_mountfs+0xcbb/0x1f00 fs/xfs/xfs_mount.c:819
 xfs_fs_fill_super+0x1145/0x13a0 fs/xfs/xfs_super.c:1681
 get_tree_bdev+0x3fe/0x620 fs/super.c:1355
 vfs_get_tree+0x88/0x270 fs/super.c:1562
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3051
 do_mount fs/namespace.c:3394 [inline]
 __do_sys_mount fs/namespace.c:3602 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3579
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f240cd772da
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 7e 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f240dc16e78 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f240dc16f00 RCX: 00007f240cd772da
RDX: 0000000020009600 RSI: 0000000020009640 RDI: 00007f240dc16ec0
RBP: 0000000020009600 R08: 00007f240dc16f00 R09: 0000000000000840
R10: 0000000000000840 R11: 0000000000000206 R12: 0000000020009640
R13: 00007f240dc16ec0 R14: 000000000000968d R15: 00000000200000c0
 </TASK>

Allocated by task 4708:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc_node+0xb3/0x230 mm/slab_common.c:962
 kmalloc_node include/linux/slab.h:582 [inline]
 kvmalloc_node+0x6e/0x180 mm/util.c:581
 xlog_do_recovery_pass+0x18d/0xec0
 xlog_verify_head+0x21b/0x5a0 fs/xfs/xfs_log_recover.c:1058
 xlog_find_tail+0x9d8/0xf80 fs/xfs/xfs_log_recover.c:1319
 xlog_recover+0xd9/0x560 fs/xfs/xfs_log_recover.c:3361
 xfs_log_mount+0x3d1/0x700 fs/xfs/xfs_log.c:733
 xfs_mountfs+0xcbb/0x1f00 fs/xfs/xfs_mount.c:819
 xfs_fs_fill_super+0x1145/0x13a0 fs/xfs/xfs_super.c:1681
 get_tree_bdev+0x3fe/0x620 fs/super.c:1355
 vfs_get_tree+0x88/0x270 fs/super.c:1562
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3051
 do_mount fs/namespace.c:3394 [inline]
 __do_sys_mount fs/namespace.c:3602 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3579
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88805ea7bc00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 0 bytes to the right of
 512-byte region [ffff88805ea7bc00, ffff88805ea7be00)

The buggy address belongs to the physical page:
page:ffffea00017a9e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5ea78
head:ffffea00017a9e00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888012441c80
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3563, tgid 3563 (syz-executor), ts 65098290276, free_ts 17730828230
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
 prep_new_page mm/page_alloc.c:2524 [inline]
 get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4283
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5551
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975
 kmalloc_reserve net/core/skbuff.c:446 [inline]
 __alloc_skb+0x135/0x670 net/core/skbuff.c:515
 alloc_skb include/linux/skbuff.h:1271 [inline]
 alloc_uevent_skb+0x74/0x220 lib/kobject_uevent.c:290
 uevent_net_broadcast_tagged lib/kobject_uevent.c:351 [inline]
 kobject_uevent_net_broadcast+0x178/0x560 lib/kobject_uevent.c:412
 kobject_uevent_env+0x576/0x8c0 lib/kobject_uevent.c:593
 __kobject_del+0xd3/0x310 lib/kobject.c:593
 kobject_cleanup lib/kobject.c:672 [inline]
 kobject_release lib/kobject.c:712 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x238/0x460 lib/kobject.c:729
 net_rx_queue_update_kobjects+0x44a/0x4c0 net/core/net-sysfs.c:1126
 netif_set_real_num_rx_queues+0xfc/0x1e0 net/core/dev.c:2968
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1444 [inline]
 free_pcp_prepare mm/page_alloc.c:1494 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3362
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3457
 free_contig_range+0x9a/0x150 mm/page_alloc.c:9511
 destroy_args+0xfe/0x997 mm/debug_vm_pgtable.c:1031
 debug_vm_pgtable+0x416/0x46b mm/debug_vm_pgtable.c:1354
 do_one_initcall+0x265/0x8f0 init/main.c:1298
 do_initcall_level+0x157/0x207 init/main.c:1371
 do_initcalls+0x49/0x86 init/main.c:1387
 kernel_init_freeable+0x45c/0x60f init/main.c:1626
 kernel_init+0x19/0x290 init/main.c:1514
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffff88805ea7bd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88805ea7bd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88805ea7be00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff88805ea7be80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805ea7bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/06 02:05 linux-6.1.y 7753af06eebf 2a40360c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Read in crypto_shash_update
2024/07/06 02:05 linux-6.1.y 7753af06eebf 2a40360c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Read in crypto_shash_update
* Struck through repros no longer work on HEAD.