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

2 views
Skip to first unread message

syzbot

unread,
Nov 25, 2023, 6:35:24 PM11/25/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 2a910f4af54d Linux 5.15.139
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=142d9a08e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=4901940b923cf2ea
dashboard link: https://syzkaller.appspot.com/bug?extid=263365d3e5fd395c52b5
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/3635f683392f/disk-2a910f4a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e6fa88fc3919/vmlinux-2a910f4a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c376027e57f4/bzImage-2a910f4a.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+263365...@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 ffff8880973e9ab8 by task syz-executor.1/3556

CPU: 1 PID: 3556 Comm: syz-executor.1 Not tainted 5.15.139-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/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:648
tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:664
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:637
irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
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:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:202
Code: b1 7e f6 ff 90 53 48 89 fb 48 83 c7 18 48 8b 74 24 08 e8 ee 89 3d f7 48 89 df e8 46 dd 3e f7 e8 11 8b 61 f7 fb bf 01 00 00 00 <e8> 26 1a 32 f7 65 8b 05 b7 55 dd 75 85 c0 74 02 5b c3 e8 44 6d db
RSP: 0018:ffffc90002ebf848 EFLAGS: 00000286
RAX: 6e5dbcf4aa85f000 RBX: ffff88801bba0990 RCX: ffffffff913c6003
RDX: dffffc0000000000 RSI: ffffffff8a8b0be0 RDI: 0000000000000001
RBP: ffff88801bba0988 R08: ffffffff8186a540 R09: ffffed1003774133
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffea0002aadac0
R13: 00fff00000080035 R14: ffffea0002aadac8 R15: ffffea0002aadac0
spin_unlock_irq include/linux/spinlock.h:413 [inline]
delete_from_page_cache+0x12e/0x190 mm/filemap.c:267
truncate_inode_page+0x8d/0xb0 mm/truncate.c:219
shmem_undo_range+0x535/0x1b50 mm/shmem.c:960
shmem_truncate_range mm/shmem.c:1063 [inline]
shmem_evict_inode+0x21b/0xa00 mm/shmem.c:1145
evict+0x2a4/0x620 fs/inode.c:587
__dentry_kill+0x436/0x650 fs/dcache.c:582
dentry_kill+0xbb/0x290
dput+0x1f1/0x420 fs/dcache.c:888
__fput+0x5ec/0x890 fs/file_table.c:288
task_work_run+0x129/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
__syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f1f23dcbe17
Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007fffb9fdf0f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f1f23dcbe17
RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007fffb9fdf1b0
RBP: 00007fffb9fdf1b0 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007fffb9fe0270
R13: 00007f1f23e153b9 R14: 0000000000105844 R15: 0000000000000014
</TASK>

Allocated by task 3593:
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_node_track_caller+0x195/0x390 mm/slub.c:4963
kmalloc_reserve net/core/skbuff.c:356 [inline]
__alloc_skb+0x12c/0x590 net/core/skbuff.c:427
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+0x25e/0xab0 drivers/net/netdevsim/dev.c:762
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Freed by task 3593:
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
skb_free_head net/core/skbuff.c:655 [inline]
skb_release_data+0x73a/0x8a0 net/core/skbuff.c:677
skb_release_all net/core/skbuff.c:742 [inline]
__kfree_skb net/core/skbuff.c:756 [inline]
consume_skb+0xa3/0x140 net/core/skbuff.c:914
nsim_dev_trap_report drivers/net/netdevsim/dev.c:737 [inline]
nsim_dev_trap_report_work+0x788/0xab0 drivers/net/netdevsim/dev.c:762
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff8880973e8000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2744 bytes to the right of
4096-byte region [ffff8880973e8000, ffff8880973e9000)
The buggy address belongs to the page:
page:ffffea00025cfa00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x973e8
head:ffffea00025cfa00 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 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3593, ts 1063572554228, free_ts 1063457321658
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]
__kmalloc_node_track_caller+0x1f6/0x390 mm/slub.c:4958
kmalloc_reserve net/core/skbuff.c:356 [inline]
__alloc_skb+0x12c/0x590 net/core/skbuff.c:427
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+0x25e/0xab0 drivers/net/netdevsim/dev.c:762
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
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]
__kmalloc+0x120/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]
__do_sys_newfstatat fs/stat.c:411 [inline]
__se_sys_newfstatat fs/stat.c:405 [inline]
__x64_sys_newfstatat+0x12c/0x1b0 fs/stat.c:405

Memory state around the buggy address:
ffff8880973e9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880973e9a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880973e9a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8880973e9b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880973e9b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: b1 7e mov $0x7e,%cl
2: f6 ff idiv %bh
4: 90 nop
5: 53 push %rbx
6: 48 89 fb mov %rdi,%rbx
9: 48 83 c7 18 add $0x18,%rdi
d: 48 8b 74 24 08 mov 0x8(%rsp),%rsi
12: e8 ee 89 3d f7 call 0xf73d8a05
17: 48 89 df mov %rbx,%rdi
1a: e8 46 dd 3e f7 call 0xf73edd65
1f: e8 11 8b 61 f7 call 0xf7618b35
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 26 1a 32 f7 call 0xf7321a55 <-- trapping instruction
2f: 65 8b 05 b7 55 dd 75 mov %gs:0x75dd55b7(%rip),%eax # 0x75dd55ed
36: 85 c0 test %eax,%eax
38: 74 02 je 0x3c
3a: 5b pop %rbx
3b: c3 ret
3c: e8 .byte 0xe8
3d: 44 6d rex.R insl (%dx),%es:(%rdi)
3f: db .byte 0xdb


---
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 report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

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

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

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

syzbot

unread,
Mar 4, 2024, 6:35:17 PMMar 4
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