[v5.15] KASAN: slab-out-of-bounds Read in smc_fback_error_report

0 views
Skip to first unread message

syzbot

unread,
Jun 19, 2023, 8:01:58 PM6/19/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 471e639e59d1 Linux 5.15.117
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17ebd940a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=6390289bcc1381aa
dashboard link: https://syzkaller.appspot.com/bug?extid=c931bee5e27213f40132
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e7a6fa06f105/disk-471e639e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/da120c6c6db1/vmlinux-471e639e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/930eedb9554d/bzImage-471e639e.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+c931be...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in smc_fback_error_report+0x6d/0x90 net/smc/af_smc.c:652
Read of size 8 at addr ffff888026a0baf8 by task syz-executor.0/16618

CPU: 0 PID: 16618 Comm: syz-executor.0 Not tainted 5.15.117-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
smc_fback_error_report+0x6d/0x90 net/smc/af_smc.c:652
sk_error_report+0x3b/0x260 net/core/sock.c:339
tcp_write_err net/ipv4/tcp_timer.c:71 [inline]
tcp_probe_timer net/ipv4/tcp_timer.c:396 [inline]
tcp_write_timer_handler+0x6d9/0x9c0 net/ipv4/tcp_timer.c:630
tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:646
call_timer_fn+0x16d/0x560 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1737
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1750
__do_softirq+0x3b3/0x93a kernel/softirq.c:558
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x155/0x240 kernel/softirq.c:636
irq_exit_rcu+0x5/0x20 kernel/softirq.c:648
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:memset_erms+0xb/0x10 arch/x86/lib/memset_64.S:65
Code: 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 f3 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 f3 aa <4c> 89 c8 c3 90 49 89 fa 40 0f b6 ce 48 b8 01 01 01 01 01 01 01 01
RSP: 0018:ffffc90003c1f418 EFLAGS: 00000202
RAX: ffffffff821b1300 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: 0000000000000028 RSI: 0000000000000000 RDI: ffffc90003c1f508
RBP: ffffc90003c1f590 R08: dffffc0000000000 R09: ffffc90003c1f4e0
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc90003c1f600
R13: ffff888047780c98 R14: ffffc90003c1f730 R15: ffffc90003c1f4e0
__ext4_get_inode_loc+0xb6/0xcd0 fs/ext4/inode.c:4294
ext4_get_inode_loc fs/ext4/inode.c:4448 [inline]
ext4_reserve_inode_write+0x1bf/0x3d0 fs/ext4/inode.c:5789
__ext4_mark_inode_dirty+0x1d6/0x860 fs/ext4/inode.c:5966
ext4_dirty_inode+0xbf/0x100 fs/ext4/inode.c:6003
__mark_inode_dirty+0x2fd/0xd60 fs/fs-writeback.c:2442
mark_inode_dirty include/linux/fs.h:2393 [inline]
generic_write_end+0x232/0x440 fs/buffer.c:2204
ext4_da_write_end+0x72d/0x9e0 fs/ext4/inode.c:3094
generic_perform_write+0x3b7/0x5b0 mm/filemap.c:3787
ext4_buffered_write_iter+0x227/0x360 fs/ext4/file.c:268
ext4_file_write_iter+0x87c/0x1990
call_write_iter include/linux/fs.h:2103 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xacf/0xe50 fs/read_write.c:594
ksys_write+0x1a2/0x2c0 fs/read_write.c:647
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+0x61/0xcb
RIP: 0033:0x7fa4d296c389
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:00007fa4d0ede168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fa4d2a8bf80 RCX: 00007fa4d296c389
RDX: 000000011ffffce1 RSI: 0000000020000080 RDI: 0000000000000007
RBP: 00007fa4d29b7493 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fffca1e079f R14: 00007fa4d0ede300 R15: 0000000000022000
</TASK>

Allocated by task 3518:
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_kmalloc+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
__kmalloc+0x168/0x300 mm/slub.c:4407
kmalloc include/linux/slab.h:596 [inline]
tomoyo_realpath_from_path+0xd8/0x5e0 security/tomoyo/realpath.c:254
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x273/0x6b0 security/tomoyo/file.c:822
tomoyo_path_unlink+0xcc/0x100 security/tomoyo/tomoyo.c:149
security_path_unlink+0xd7/0x130 security/security.c:1170
do_unlinkat+0x3d7/0x940 fs/namei.c:4273
__do_sys_unlink fs/namei.c:4325 [inline]
__se_sys_unlink fs/namei.c:4323 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4323
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+0x61/0xcb

Freed by task 3518:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0xf1/0x270 mm/slub.c:4559
tomoyo_realpath_from_path+0x5ad/0x5e0 security/tomoyo/realpath.c:291
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x273/0x6b0 security/tomoyo/file.c:822
tomoyo_path_unlink+0xcc/0x100 security/tomoyo/tomoyo.c:149
security_path_unlink+0xd7/0x130 security/security.c:1170
do_unlinkat+0x3d7/0x940 fs/namei.c:4273
__do_sys_unlink fs/namei.c:4325 [inline]
__se_sys_unlink fs/namei.c:4323 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4323
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+0x61/0xcb

The buggy address belongs to the object at ffff888026a0a000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2808 bytes to the right of
4096-byte region [ffff888026a0a000, ffff888026a0b000)
The buggy address belongs to the page:
page:ffffea00009a8200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x26a08
head:ffffea00009a8200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888011c42140
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 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3518, ts 1810029193030, free_ts 1802221383489
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5421
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
__kmalloc+0x1c9/0x300 mm/slub.c:4403
kmalloc include/linux/slab.h:596 [inline]
tomoyo_realpath_from_path+0xd8/0x5e0 security/tomoyo/realpath.c:254
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x273/0x6b0 security/tomoyo/file.c:822
security_inode_getattr+0xcf/0x120 security/security.c:1348
vfs_getattr+0x26/0x360 fs/stat.c:157
vfs_statx+0x18f/0x3b0 fs/stat.c:225
vfs_fstatat fs/stat.c:243 [inline]
vfs_lstat include/linux/fs.h:3314 [inline]
__do_sys_newlstat fs/stat.c:397 [inline]
__se_sys_newlstat fs/stat.c:391 [inline]
__x64_sys_newlstat+0xe5/0x160 fs/stat.c:391
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+0x61/0xcb
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_slab mm/slub.c:2015 [inline]
discard_slab mm/slub.c:2021 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:711 [inline]
taskstats_tgid_alloc kernel/taskstats.c:561 [inline]
taskstats_exit+0xc6/0xa10 kernel/taskstats.c:600
do_exit+0x621/0x2480 kernel/exit.c:857
do_group_exit+0x144/0x310 kernel/exit.c:994
get_signal+0xc66/0x14e0 kernel/signal.c:2889
arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:865
handle_signal_work kernel/entry/common.c:148 [inline]
exit_to_user_mode_loop+0x97/0x130 kernel/entry/common.c:172

Memory state around the buggy address:
ffff888026a0b980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888026a0ba00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888026a0ba80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888026a0bb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888026a0bb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 03 40 0f add 0xf(%rax),%eax
3: b6 f6 mov $0xf6,%dh
5: 48 b8 01 01 01 01 01 movabs $0x101010101010101,%rax
c: 01 01 01
f: 48 0f af c6 imul %rsi,%rax
13: f3 48 ab rep stos %rax,%es:(%rdi)
16: 89 d1 mov %edx,%ecx
18: f3 aa rep stos %al,%es:(%rdi)
1a: 4c 89 c8 mov %r9,%rax
1d: c3 retq
1e: 90 nop
1f: 49 89 f9 mov %rdi,%r9
22: 40 88 f0 mov %sil,%al
25: 48 89 d1 mov %rdx,%rcx
28: f3 aa rep stos %al,%es:(%rdi)
* 2a: 4c 89 c8 mov %r9,%rax <-- trapping instruction
2d: c3 retq
2e: 90 nop
2f: 49 89 fa mov %rdi,%r10
32: 40 0f b6 ce movzbl %sil,%ecx
36: 48 b8 01 01 01 01 01 movabs $0x101010101010101,%rax
3d: 01 01 01


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Sep 27, 2023, 8:01:46 PM9/27/23
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages