KASAN: slab-use-after-free Read in llc_conn_ac_send_sabme_cmd_p_set_x
Subsystems (3)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: a13c140cc289 Linux 7.2-rc3 git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=144c3b89580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d69870d5e052935f dashboard link: https://syzkaller.appspot.com/bug?extid=44efda9647c52be29d9c compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2052a80016f0/disk-a13c140c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0d06ec9d98a4/vmlinux-a13c140c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8cfe7c92eaf6/bzImage-a13c140c.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
==================================================================
BUG: KASAN: slab-use-after-free in llc_conn_ac_send_sabme_cmd_p_set_x+0x442/0x470 net/llc/llc_c_ac.c:782 Read of size 1 at addr ffff8880370c8010 by task kworker/u8:0/11804 CPU: 0 UID: 0 PID: 11804 Comm: kworker/u8:0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/10/2026 Workqueue: events_unbound toggle_allocation_gate Call Trace: <IRQ> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 llc_conn_ac_send_sabme_cmd_p_set_x+0x442/0x470 net/llc/llc_c_ac.c:782 llc_exec_conn_trans_actions net/llc/llc_conn.c:437 [inline] llc_conn_service net/llc/llc_conn.c:362 [inline] llc_conn_state_process+0x3ec/0x1480 net/llc/llc_conn.c:66 llc_process_tmr_ev net/llc/llc_c_ac.c:1442 [inline] llc_conn_tmr_common_cb+0x2d4/0x880 net/llc/llc_c_ac.c:1325 call_timer_fn+0x19a/0x610 kernel/time/timer.c:1748 expire_timers kernel/time/timer.c:1799 [inline] __run_timers+0x757/0xb00 kernel/time/timer.c:2374 __run_timer_base kernel/time/timer.c:2386 [inline] __run_timer_base kernel/time/timer.c:2378 [inline] run_timer_base+0x114/0x190 kernel/time/timer.c:2395 run_timer_softirq+0x1a/0x50 kernel/time/timer.c:2405 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062 </IRQ> <TASK> asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 RIP: 0010:finish_task_switch.isra.0+0x2cd/0x10c0 kernel/sched/core.c:5361 Code: ab 0a 00 00 41 c7 87 20 0e 00 00 00 00 00 00 e9 47 04 00 00 49 8d 7f 48 e8 30 b4 e6 09 e8 1b a9 3c 00 fb 48 8d bb f8 16 00 00 <48> b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 04 02 84 RSP: 0018:ffffc90005097578 EFLAGS: 00000202 RAX: 0000000000056db3 RBX: ffff8880741c8000 RCX: 0000000000000040 RDX: 0000000000000000 RSI: ffffffff8e1a3c59 RDI: ffff8880741c96f8 RBP: ffffc900050975d0 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff8e891480 R13: 0000000000000001 R14: ffffffff91227064 R15: ffff8880b843b4c0 context_switch kernel/sched/core.c:5513 [inline] __schedule+0x1264/0x6730 kernel/sched/core.c:7234 preempt_schedule_irq+0x50/0x90 kernel/sched/core.c:7556 irqentry_exit_to_kernel_mode_preempt include/linux/irq-entry-common.h:468 [inline] irqentry_exit_to_kernel_mode include/linux/irq-entry-common.h:539 [inline] irqentry_exit+0x205/0xa00 kernel/entry/common.c:167 asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:679 RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x70 kernel/kcov.c:210 Code: 56 e1 5e 00 48 89 df 5b e9 9d 5c 64 00 be 03 00 00 00 5b e9 32 5a 13 03 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 <f3> 0f 1e fa 65 8b 05 85 a3 59 12 48 8b 34 24 65 48 8b 15 61 a3 59 RSP: 0018:ffffc90005097850 EFLAGS: 00000206 RAX: 0000000000000000 RBX: ffffc900050979b0 RCX: ffffffff8bb86f00 RDX: 0000000000008000 RSI: 0000000000000000 RDI: ffff8880741c8000 RBP: ffffc900050979d4 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000008000 R11: 0000000000000000 R12: ffffc900050979fc R13: 0000000000008000 R14: 0000000000008000 R15: 0000000000000ffa insn_get_modrm+0xee/0x790 arch/x86/lib/insn.c:396 insn_get_sib arch/x86/lib/insn.c:466 [inline] insn_get_displacement+0x2f9/0x960 arch/x86/lib/insn.c:507 insn_get_immediate+0x84/0x1e00 arch/x86/lib/insn.c:673 insn_get_length arch/x86/lib/insn.c:745 [inline] insn_decode+0x21d/0x320 arch/x86/lib/insn.c:784 __smp_text_poke_batch_add+0x174/0x790 arch/x86/kernel/alternative.c:3103 arch_jump_label_transform_queue+0xaf/0x120 arch/x86/kernel/jump_label.c:138 __jump_label_update+0xd7/0x380 kernel/jump_label.c:513 jump_label_update+0x37a/0x550 kernel/jump_label.c:910 static_key_disable_cpuslocked+0x162/0x1c0 kernel/jump_label.c:240 static_key_disable+0x1a/0x20 kernel/jump_label.c:248 toggle_allocation_gate mm/kfence/core.c:918 [inline] toggle_allocation_gate+0x149/0x2d0 mm/kfence/core.c:903 process_one_work+0xa23/0x1940 kernel/workqueue.c:3322 process_scheduled_works kernel/workqueue.c:3405 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 </TASK> Allocated by task 12543: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2e5/0x6c0 mm/slub.c:5515 _kmalloc_noprof include/linux/slab.h:969 [inline] _kzalloc_noprof include/linux/slab.h:1290 [inline] llc_sap_alloc net/llc/llc_core.c:29 [inline] llc_sap_open+0x120/0x3b0 net/llc/llc_core.c:96 llc_ui_autobind.isra.0+0x2ae/0x580 net/llc/af_llc.c:301 llc_ui_connect+0x582/0xdb0 net/llc/af_llc.c:498 __sys_connect_file+0x141/0x1a0 net/socket.c:2135 __sys_connect+0x141/0x170 net/socket.c:2154 __do_sys_connect net/socket.c:2160 [inline] __se_sys_connect net/socket.c:2157 [inline] __x64_sys_connect+0x72/0xb0 net/socket.c:2157 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 0: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2705 [inline] __rcu_free_sheaf_prepare+0x5d/0x2f0 mm/slub.c:2956 rcu_free_sheaf+0x1a/0xe0 mm/slub.c:6004 rcu_do_batch kernel/rcu/tree.c:2645 [inline] rcu_core+0x5a2/0x10d0 kernel/rcu/tree.c:2897 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_call_function_single arch/x86/kernel/smp.c:267 [inline] sysvec_call_function_single+0xa3/0xc0 arch/x86/kernel/smp.c:267 asm_sysvec_call_function_single+0x1a/0x20 arch/x86/include/asm/idtentry.h:681 The buggy address belongs to the object at ffff8880370c8000 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 16 bytes inside of
freed 2048-byte region [ffff8880370c8000, ffff8880370c8800)
The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880370cd000 pfn:0x370c8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88813fe22000 ffffea0000c73e10 ffffea0000a2e810 raw: ffff8880370cd000 0000000800080007 00000000f5000000 0000000000000000
head: 00fff00000000240 ffff88813fe22000 ffffea0000c73e10 ffffea0000a2e810
head: ffff8880370cd000 0000000800080007 00000000f5000000 0000000000000000
head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5615, tgid 5615 (syz-executor), ts 66637688496, free_ts 48968356257
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859
prep_new_page mm/page_alloc.c:1867 [inline]
get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946
__alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304
alloc_slab_page mm/slub.c:3294 [inline]
allocate_slab mm/slub.c:3408 [inline]
new_slab+0xa2/0x650 mm/slub.c:3454
refill_objects+0xe3/0x410 mm/slub.c:7338
refill_sheaf mm/slub.c:2832 [inline]
__pcs_replace_empty_main+0x376/0x680 mm/slub.c:4703
alloc_from_pcs mm/slub.c:4801 [inline]
slab_alloc_node mm/slub.c:4933 [inline]
__do_kmalloc_node mm/slub.c:5361 [inline]
__kmalloc_node_track_caller_noprof+0x679/0x830 mm/slub.c:5497
kmalloc_reserve+0xe8/0x350 net/core/skbuff.c:637
pskb_expand_head+0x249/0x10e0 net/core/skbuff.c:2306
netlink_trim+0x22d/0x2f0 net/netlink/af_netlink.c:1300
netlink_broadcast_filtered+0x6d/0xf20 net/netlink/af_netlink.c:1518
nlmsg_multicast_filtered include/net/netlink.h:1165 [inline]
nlmsg_multicast include/net/netlink.h:1184 [inline]
nlmsg_notify+0xb1/0x290 net/netlink/af_netlink.c:2599
rtnl_notify net/core/rtnetlink.c:963 [inline]
rtmsg_ifinfo_send net/core/rtnetlink.c:4553 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:4569 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:4556 [inline]
rtmsg_ifinfo+0x177/0x1b0 net/core/rtnetlink.c:4575
__dev_notify_flags+0x24c/0x2e0 net/core/dev.c:9789
rtnl_configure_link+0x1b5/0x280 net/core/rtnetlink.c:3679
rtnl_newlink_create net/core/rtnetlink.c:3923 [inline]
__rtnl_newlink net/core/rtnetlink.c:4044 [inline]
rtnl_newlink+0x153b/0x2380 net/core/rtnetlink.c:4159
page last free pid 5271 tgid 5271 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
__free_pages_prepare mm/page_alloc.c:1406 [inline]
__free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350
kasan_slab_alloc include/linux/kasan.h:253 [inline]
slab_post_alloc_hook mm/slub.c:4612 [inline]
slab_alloc_node mm/slub.c:4945 [inline]
kmem_cache_alloc_node_noprof+0x27d/0x6b0 mm/slub.c:5017
__alloc_skb+0x140/0x710 net/core/skbuff.c:704
alloc_skb include/linux/skbuff.h:1384 [inline]
alloc_skb_with_frags+0xdd/0x760 net/core/skbuff.c:6769
sock_alloc_send_pskb+0x801/0x980 net/core/sock.c:3010
unix_dgram_sendmsg+0x3c7/0x1810 net/unix/af_unix.c:2136
unix_seqpacket_sendmsg+0x12a/0x1d0 net/unix/af_unix.c:2537
sock_sendmsg_nosec net/socket.c:775 [inline]
__sock_sendmsg net/socket.c:790 [inline]
sock_write_iter+0x53a/0x5b0 net/socket.c:1241
do_iter_readv_writev+0x6f7/0x930 fs/read_write.c:828
vfs_writev+0x360/0xdd0 fs/read_write.c:1058
do_writev+0x28a/0x340 fs/read_write.c:1104
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff8880370c7f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880370c7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880370c8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880370c8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880370c8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 87 20 0e 00 00 movl $0x0,0xe20(%r15)
9: 00 00 00 00
d: e9 47 04 00 00 jmp 0x459
12: 49 8d 7f 48 lea 0x48(%r15),%rdi
16: e8 30 b4 e6 09 call 0x9e6b44b
1b: e8 1b a9 3c 00 call 0x3ca93b
20: fb sti
21: 48 8d bb f8 16 00 00 lea 0x16f8(%rbx),%rdi
* 28: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax <-- trapping instruction
2f: fc ff df
32: 48 89 fa mov %rdi,%rdx
35: 48 c1 ea 03 shr $0x3,%rdx
39: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
3d: 84 .byte 0x84---
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 [email protected].
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
Hi,
Quoted 252 lines · syzbot
Hello,
syzbot found the following issue on:
HEAD commit: a13c140cc289 Linux 7.2-rc3 git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=144c3b89580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d69870d5e052935f dashboard link: https://syzkaller.appspot.com/bug?extid=44efda9647c52be29d9c compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2052a80016f0/disk-a13c140c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0d06ec9d98a4/vmlinux-a13c140c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8cfe7c92eaf6/bzImage-a13c140c.xzIMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by [email protected]==================================================================
BUG: KASAN: slab-use-after-free in llc_conn_ac_send_sabme_cmd_p_set_x+0x442/0x470 net/llc/llc_c_ac.c:782 Read of size 1 at addr ffff8880370c8010 by task kworker/u8:0/11804 CPU: 0 UID: 0 PID: 11804 Comm: kworker/u8:0 Not tainted syzkaller >0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/10/2026 Workqueue: events_unbound toggle_allocation_gate Call Trace: <IRQ> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 llc_conn_ac_send_sabme_cmd_p_set_x+0x442/0x470 net/llc/llc_c_ac.c:782 llc_exec_conn_trans_actions net/llc/llc_conn.c:437 [inline] llc_conn_service net/llc/llc_conn.c:362 [inline] llc_conn_state_process+0x3ec/0x1480 net/llc/llc_conn.c:66 llc_process_tmr_ev net/llc/llc_c_ac.c:1442 [inline] llc_conn_tmr_common_cb+0x2d4/0x880 net/llc/llc_c_ac.c:1325 call_timer_fn+0x19a/0x610 kernel/time/timer.c:1748 expire_timers kernel/time/timer.c:1799 [inline] __run_timers+0x757/0xb00 kernel/time/timer.c:2374 __run_timer_base kernel/time/timer.c:2386 [inline] __run_timer_base kernel/time/timer.c:2378 [inline] run_timer_base+0x114/0x190 kernel/time/timer.c:2395 run_timer_softirq+0x1a/0x50 kernel/time/timer.c:2405 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062 </IRQ> <TASK> asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 RIP: 0010:finish_task_switch.isra.0+0x2cd/0x10c0 kernel/sched/core.c:5361 Code: ab 0a 00 00 41 c7 87 20 0e 00 00 00 00 00 00 e9 47 04 00 00 49 8d 7f 48 e8 30 b4 e6 09 e8 1b a9 3c 00 fb 48 8d bb f8 16 00 00 <48> b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 04 02 84 RSP: 0018:ffffc90005097578 EFLAGS: 00000202 RAX: 0000000000056db3 RBX: ffff8880741c8000 RCX: 0000000000000040 RDX: 0000000000000000 RSI: ffffffff8e1a3c59 RDI: ffff8880741c96f8 RBP: ffffc900050975d0 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff8e891480 R13: 0000000000000001 R14: ffffffff91227064 R15: ffff8880b843b4c0 context_switch kernel/sched/core.c:5513 [inline] __schedule+0x1264/0x6730 kernel/sched/core.c:7234 preempt_schedule_irq+0x50/0x90 kernel/sched/core.c:7556 irqentry_exit_to_kernel_mode_preempt include/linux/irq-entry-common.h:468 [inline] irqentry_exit_to_kernel_mode include/linux/irq-entry-common.h:539 [inline] irqentry_exit+0x205/0xa00 kernel/entry/common.c:167 asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:679 RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x70 kernel/kcov.c:210 Code: 56 e1 5e 00 48 89 df 5b e9 9d 5c 64 00 be 03 00 00 00 5b e9 32 5a 13 03 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 <f3> 0f 1e fa 65 8b 05 85 a3 59 12 48 8b 34 24 65 48 8b 15 61 a3 59 RSP: 0018:ffffc90005097850 EFLAGS: 00000206 RAX: 0000000000000000 RBX: ffffc900050979b0 RCX: ffffffff8bb86f00 RDX: 0000000000008000 RSI: 0000000000000000 RDI: ffff8880741c8000 RBP: ffffc900050979d4 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000008000 R11: 0000000000000000 R12: ffffc900050979fc R13: 0000000000008000 R14: 0000000000008000 R15: 0000000000000ffa insn_get_modrm+0xee/0x790 arch/x86/lib/insn.c:396 insn_get_sib arch/x86/lib/insn.c:466 [inline] insn_get_displacement+0x2f9/0x960 arch/x86/lib/insn.c:507 insn_get_immediate+0x84/0x1e00 arch/x86/lib/insn.c:673 insn_get_length arch/x86/lib/insn.c:745 [inline] insn_decode+0x21d/0x320 arch/x86/lib/insn.c:784 __smp_text_poke_batch_add+0x174/0x790 arch/x86/kernel/alternative.c:3103 arch_jump_label_transform_queue+0xaf/0x120 arch/x86/kernel/jump_label.c:138 __jump_label_update+0xd7/0x380 kernel/jump_label.c:513 jump_label_update+0x37a/0x550 kernel/jump_label.c:910 static_key_disable_cpuslocked+0x162/0x1c0 kernel/jump_label.c:240 static_key_disable+0x1a/0x20 kernel/jump_label.c:248 toggle_allocation_gate mm/kfence/core.c:918 [inline] toggle_allocation_gate+0x149/0x2d0 mm/kfence/core.c:903 process_one_work+0xa23/0x1940 kernel/workqueue.c:3322 process_scheduled_works kernel/workqueue.c:3405 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 </TASK> Allocated by task 12543: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2e5/0x6c0 mm/slub.c:5515 _kmalloc_noprof include/linux/slab.h:969 [inline] _kzalloc_noprof include/linux/slab.h:1290 [inline] llc_sap_alloc net/llc/llc_core.c:29 [inline] llc_sap_open+0x120/0x3b0 net/llc/llc_core.c:96 llc_ui_autobind.isra.0+0x2ae/0x580 net/llc/af_llc.c:301 llc_ui_connect+0x582/0xdb0 net/llc/af_llc.c:498 __sys_connect_file+0x141/0x1a0 net/socket.c:2135 __sys_connect+0x141/0x170 net/socket.c:2154 __do_sys_connect net/socket.c:2160 [inline] __se_sys_connect net/socket.c:2157 [inline] __x64_sys_connect+0x72/0xb0 net/socket.c:2157 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 0: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2705 [inline] __rcu_free_sheaf_prepare+0x5d/0x2f0 mm/slub.c:2956 rcu_free_sheaf+0x1a/0xe0 mm/slub.c:6004 rcu_do_batch kernel/rcu/tree.c:2645 [inline] rcu_core+0x5a2/0x10d0 kernel/rcu/tree.c:2897 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_call_function_single arch/x86/kernel/smp.c:267 [inline] sysvec_call_function_single+0xa3/0xc0 arch/x86/kernel/smp.c:267 asm_sysvec_call_function_single+0x1a/0x20 arch/x86/include/asm/idtentry.h:681 The buggy address belongs to the object at ffff8880370c8000which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 16 bytes inside of freed 2048-byte region [
ffff8880370c8000,ffff8880370c8800)The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880370cd000 pfn:0x370c8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88813fe22000 ffffea0000c73e10 ffffea0000a2e810 raw: ffff8880370cd000 0000000800080007 00000000f5000000 0000000000000000head:
00fff00000000240ffff88813fe22000ffffea0000c73e10ffffea0000a2e810
head:ffff8880370cd000000000080008000700000000f50000000000000000000000
head:00fff00000000003fffffffffffffe0100000000ffffffff00000000ffffffff
head: ffffffffffffffff 000000000000000000000000ffffffff0000000000000008page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5615, tgid 5615 (syz-executor), ts 66637688496, free_ts 48968356257 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_slab_page mm/slub.c:3294 [inline] allocate_slab mm/slub.c:3408 [inline] new_slab+0xa2/0x650 mm/slub.c:3454 refill_objects+0xe3/0x410 mm/slub.c:7338 refill_sheaf mm/slub.c:2832 [inline] __pcs_replace_empty_main+0x376/0x680 mm/slub.c:4703 alloc_from_pcs mm/slub.c:4801 [inline] slab_alloc_node mm/slub.c:4933 [inline] __do_kmalloc_node mm/slub.c:5361 [inline] __kmalloc_node_track_caller_noprof+0x679/0x830 mm/slub.c:5497 kmalloc_reserve+0xe8/0x350 net/core/skbuff.c:637 pskb_expand_head+0x249/0x10e0 net/core/skbuff.c:2306 netlink_trim+0x22d/0x2f0 net/netlink/af_netlink.c:1300 netlink_broadcast_filtered+0x6d/0xf20 net/netlink/af_netlink.c:1518 nlmsg_multicast_filtered include/net/netlink.h:1165 [inline] nlmsg_multicast include/net/netlink.h:1184 [inline] nlmsg_notify+0xb1/0x290 net/netlink/af_netlink.c:2599 rtnl_notify net/core/rtnetlink.c:963 [inline] rtmsg_ifinfo_send net/core/rtnetlink.c:4553 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:4569 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:4556 [inline] rtmsg_ifinfo+0x177/0x1b0 net/core/rtnetlink.c:4575 __dev_notify_flags+0x24c/0x2e0 net/core/dev.c:9789 rtnl_configure_link+0x1b5/0x280 net/core/rtnetlink.c:3679 rtnl_newlink_create net/core/rtnetlink.c:3923 [inline] __rtnl_newlink net/core/rtnetlink.c:4044 [inline] rtnl_newlink+0x153b/0x2380 net/core/rtnetlink.c:4159 page last free pid 5271 tgid 5271 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4612 [inline] slab_alloc_node mm/slub.c:4945 [inline] kmem_cache_alloc_node_noprof+0x27d/0x6b0 mm/slub.c:5017 __alloc_skb+0x140/0x710 net/core/skbuff.c:704 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xdd/0x760 net/core/skbuff.c:6769 sock_alloc_send_pskb+0x801/0x980 net/core/sock.c:3010 unix_dgram_sendmsg+0x3c7/0x1810 net/unix/af_unix.c:2136 unix_seqpacket_sendmsg+0x12a/0x1d0 net/unix/af_unix.c:2537 sock_sendmsg_nosec net/socket.c:775 [inline] __sock_sendmsg net/socket.c:790 [inline] sock_write_iter+0x53a/0x5b0 net/socket.c:1241 do_iter_readv_writev+0x6f7/0x930 fs/read_write.c:828 vfs_writev+0x360/0xdd0 fs/read_write.c:1058 do_writev+0x28a/0x340 fs/read_write.c:1104 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880370c7f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880370c7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880370c8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880370c8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880370c8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 00 00 add %al,(%rax) 2: 41 c7 87 20 0e 00 00 movl $0x0,0xe20(%r15) 9: 00 00 00 00 d: e9 47 04 00 00 jmp 0x459 12: 49 8d 7f 48 lea 0x48(%r15),%rdi 16: e8 30 b4 e6 09 call 0x9e6b44b 1b: e8 1b a9 3c 00 call 0x3ca93b 20: fb sti 21: 48 8d bb f8 16 00 00 lea 0x16f8(%rbx),%rdi * 28: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax <-- trapping instruction 2f: fc ff df 32: 48 89 fa mov %rdi,%rdx 35: 48 c1 ea 03 shr $0x3,%rdx 39: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax 3d: 84 .byte 0x84
Quoted 1 line
---
Before I go further, I would like to say that I am relatively new to this subsystem and anything I say must be taken with a grain of salt. If possible, I would like you to educate me further on this topic.
I have analyzed this issue and with the limited knowledge I have, I have reached a potential conclusion. Looking at all possible state transitions, nearly every state starts with our function at fault(llc_conn_ac_send_sabme_cmd_p_set_x()). Timers are deleted further back in the state transitions(llc_conn_ac_stop_other_timers()).
static const llc_conn_action_t llc_common_actions_2[] = {
*[0] = llc_conn_ac_send_sabme_cmd_p_set_x,
[1] = llc_conn_ac_start_ack_timer,
*[2] = llc_conn_ac_stop_other_timers,
[3] = llc_conn_ac_set_retry_cnt_0,
[4] = llc_conn_ac_set_cause_flag_1,
[5] = NULL,
};That leaves one plausible explanation: There is a potential race condition occurring between 2 or more CPUs. State transitions that use llc_conn_ac_stop_other_timers() use timer_delete() for all timers except the ack_timer. Since timer_delete() does not synchronize the callbacks, if a second CPU attempts a callback concurrently right as the first CPU executed the timer_delete() or before it moves to LLC_CONN_STATE_RESET, it could cause a UAF(or am I mistaken?)
If possible, I would like to know if this is the correct cause for the UAF or if I am looking in the wrong place entirely?
Thanks,
Jeffin.
syzbot
syzbotsyzbot has found a reproducer for the following issue on:
syzbot has found a reproducer for the following issue on:
HEAD commit: 3eb40771c00a Merge tag 'soc-fixes-7.2-3' of git://git.kern.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=13e296c6580000 kernel config: https://syzkaller.appspot.com/x/.config?x=1d67342c314f228d dashboard link: https://syzkaller.appspot.com/bug?extid=44efda9647c52be29d9c compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=109f1949580000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
==================================================================
BUG: KASAN: slab-use-after-free in llc_conn_ac_send_sabme_cmd_p_set_x+0x442/0x470 net/llc/llc_c_ac.c:782 Read of size 1 at addr ffff888058d87010 by task syz-executor377/6034 CPU: 3 UID: 0 PID: 6034 Comm: syz-executor377 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 llc_conn_ac_send_sabme_cmd_p_set_x+0x442/0x470 net/llc/llc_c_ac.c:782 llc_exec_conn_trans_actions net/llc/llc_conn.c:437 [inline] llc_conn_service net/llc/llc_conn.c:362 [inline] llc_conn_state_process+0x3ec/0x1480 net/llc/llc_conn.c:66 llc_process_tmr_ev net/llc/llc_c_ac.c:1442 [inline] llc_conn_tmr_common_cb+0x2d4/0x880 net/llc/llc_c_ac.c:1325 call_timer_fn+0x19a/0x610 kernel/time/timer.c:1748 expire_timers kernel/time/timer.c:1799 [inline] __run_timers+0x757/0xb00 kernel/time/timer.c:2374 __run_timer_base kernel/time/timer.c:2386 [inline] __run_timer_base kernel/time/timer.c:2378 [inline] run_timer_base+0x114/0x190 kernel/time/timer.c:2395 run_timer_softirq+0x1a/0x50 kernel/time/timer.c:2405 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062 </IRQ> <TASK> asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 RIP: 0010:preempt_count_sub+0x0/0x160 kernel/sched/core.c:6004 Code: 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 c7 c7 e0 bd 8a 94 e9 10 95 71 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 <f3> 0f 1e fa 48 c7 c0 00 96 93 9b 53 89 fb 48 ba 00 00 00 00 00 fc RSP: 0018:ffffc900016bfda8 EFLAGS: 00000246 RAX: 0000000000000001 RBX: ffff88803d884380 RCX: ffffffff81e65993 RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000001 RBP: 1ffff920002d7fba R08: 0000000000000000 R09: ffffed1007b10870 R10: ffff88803d884383 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 __raw_spin_unlock include/linux/spinlock_api_smp.h:169 [inline] _raw_spin_unlock+0x28/0x50 kernel/locking/spinlock.c:190 spin_unlock include/linux/spinlock.h:390 [inline] setfl fs/fcntl.c:85 [inline] do_fcntl+0x5da/0x1670 fs/fcntl.c:477 __do_sys_fcntl fs/fcntl.c:602 [inline] __se_sys_fcntl fs/fcntl.c:587 [inline] __x64_sys_fcntl+0x163/0x200 fs/fcntl.c:587 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff89b73ab00 Code: 00 00 0f 1f 84 00 00 00 00 00 48 83 ec 18 64 48 8b 04 25 28 00 00 00 48 89 44 24 08 31 c0 83 fe 09 74 27 b8 48 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 40 48 8b 54 24 08 64 48 2b 14 25 28 00 00 00 RSP: 002b:00007ff8986ff130 EFLAGS: 00000293 ORIG_RAX: 0000000000000048 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00007ff89b73ab00 RDX: 0000000000000802 RSI: 0000000000000004 RDI: 0000000000000006 RBP: 000000000000005c R08: 0000000000000004 R09: 0000000000000017 R10: 00007ff8986ff1b4 R11: 0000000000000293 R12: 0000000000000007 R13: 0000000000000022 R14: 0000000088888889 R15: 000000000000002e </TASK> Allocated by task 6032: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2e5/0x6c0 mm/slub.c:5489 _kmalloc_noprof include/linux/slab.h:988 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] llc_sap_alloc net/llc/llc_core.c:29 [inline] llc_sap_open+0x120/0x3b0 net/llc/llc_core.c:96 llc_ui_bind+0xb67/0xe40 net/llc/af_llc.c:386 __sys_bind_socket net/socket.c:1920 [inline] __sys_bind_socket net/socket.c:1912 [inline] __sys_bind+0x1a9/0x260 net/socket.c:1951 __do_sys_bind net/socket.c:1956 [inline] __se_sys_bind net/socket.c:1954 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1954 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 33: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2677 [inline] __rcu_free_sheaf_prepare+0x5d/0x2f0 mm/slub.c:2928 rcu_free_sheaf+0x1a/0xe0 mm/slub.c:5978 rcu_do_batch kernel/rcu/tree.c:2645 [inline] rcu_core+0x5a2/0x10d0 kernel/rcu/tree.c:2897 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 run_ksoftirqd kernel/softirq.c:1076 [inline] run_ksoftirqd+0x38/0x60 kernel/softirq.c:1068 smpboot_thread_fn+0x3d3/0xaa0 kernel/smpboot.c:160 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff888058d87000 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 16 bytes inside of
freed 2048-byte region [ffff888058d87000, ffff888058d87800)
The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x58d80 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801c042f00 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800080008 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801c042f00 dead000000000100 dead000000000122
head: 0000000000000000 0000000800080008 00000000f5000000 0000000000000000
head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6028, tgid 6024 (syz-executor377), ts 76930678762, free_ts 76926318518
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859
prep_new_page mm/page_alloc.c:1867 [inline]
get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946
__alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304
alloc_slab_page mm/slub.c:3266 [inline]
allocate_slab mm/slub.c:3380 [inline]
new_slab+0xa2/0x640 mm/slub.c:3426
refill_objects+0xe3/0x410 mm/slub.c:7310
refill_sheaf mm/slub.c:2804 [inline]
__pcs_replace_empty_main+0x376/0x680 mm/slub.c:4675
alloc_from_pcs mm/slub.c:4773 [inline]
slab_alloc_node mm/slub.c:4905 [inline]
__kmalloc_cache_noprof+0x479/0x6c0 mm/slub.c:5485
_kmalloc_noprof include/linux/slab.h:988 [inline]
_kzalloc_noprof include/linux/slab.h:1309 [inline]
llc_sap_alloc net/llc/llc_core.c:29 [inline]
llc_sap_open+0x120/0x3b0 net/llc/llc_core.c:96
llc_ui_bind+0xb67/0xe40 net/llc/af_llc.c:386
__sys_bind_socket net/socket.c:1920 [inline]
__sys_bind_socket net/socket.c:1912 [inline]
__sys_bind+0x1a9/0x260 net/socket.c:1951
__do_sys_bind net/socket.c:1956 [inline]
__se_sys_bind net/socket.c:1954 [inline]
__x64_sys_bind+0x72/0xb0 net/socket.c:1954
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 6028 tgid 6024 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
__free_pages_prepare mm/page_alloc.c:1406 [inline]
__free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350
kasan_slab_alloc include/linux/kasan.h:253 [inline]
slab_post_alloc_hook mm/slub.c:4584 [inline]
slab_alloc_node mm/slub.c:4917 [inline]
__kmalloc_cache_noprof+0x265/0x6c0 mm/slub.c:5485
_kmalloc_noprof include/linux/slab.h:988 [inline]
_kzalloc_noprof include/linux/slab.h:1309 [inline]
ref_tracker_alloc+0x190/0x590 lib/ref_tracker.c:270
__netdev_tracker_alloc include/linux/netdevice.h:4496 [inline]
netdev_tracker_alloc include/linux/netdevice.h:4508 [inline]
llc_ui_bind+0x77b/0xe40 net/llc/af_llc.c:412
__sys_bind_socket net/socket.c:1920 [inline]
__sys_bind_socket net/socket.c:1912 [inline]
__sys_bind+0x1a9/0x260 net/socket.c:1951
__do_sys_bind net/socket.c:1956 [inline]
__se_sys_bind net/socket.c:1954 [inline]
__x64_sys_bind+0x72/0xb0 net/socket.c:1954
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888058d86f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888058d86f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888058d87000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888058d87080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888058d87100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 90 nop
6: 90 nop
7: 90 nop
8: 90 nop
9: 90 nop
a: f3 0f 1e fa endbr64
e: 48 c7 c7 e0 bd 8a 94 mov $0xffffffff948abde0,%rdi
15: e9 10 95 71 00 jmp 0x71952a
1a: 90 nop
1b: 90 nop
1c: 90 nop
1d: 90 nop
1e: 90 nop
1f: 90 nop
20: 90 nop
21: 90 nop
22: 90 nop
23: 90 nop
24: 90 nop
25: 90 nop
26: 90 nop
27: 90 nop
28: 90 nop
29: 90 nop
* 2a: f3 0f 1e fa endbr64 <-- trapping instruction
2e: 48 c7 c0 00 96 93 9b mov $0xffffffff9b939600,%rax
35: 53 push %rbx
36: 89 fb mov %edi,%ebx
38: 48 rex.W
39: ba 00 00 00 00 mov $0x0,%edx
3e: 00 fc add %bh,%ah---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
syzbot
syzbotForwarded: [syzbot test] llc: keep SAP and netdev alive during timer shutdown
In reply to syzbotFor archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: [syzbot test] llc: keep SAP and netdev alive during timer shutdown
Author: [email protected]
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git2f2f7eeef8b0a1a9b9ca998231419873ccae8d4e
net/llc/af_llc.c +5 -6
@@ -196,6 +196,7 @@ static int llc_ui_release(struct socket *sock) {struct sock *sk = sock->sk;struct llc_sock *llc; +struct llc_sap *sap =NULL ;if (unlikely (sk ==NULL )) goto out;
@@ -207,23 +208,21 @@ static int llc_ui_release(struct socket *sock)if (!llc_send_disc (sk))llc_ui_wait_for_disc (sk,READ_ONCE (sk->sk_rcvtimeo));if (!sock_flag (sk,SOCK_ZAPPED )) { -struct llc_sap *sap = llc->sap; + sap = llc->sap; -/* Hold this for release_sock(), so that llc_backlog_rcv() -* could still use it. -*/ +/* Keep SAP alive through backlog processing and timer shutdown. */ llc_sap_hold (sap);llc_sap_remove_socket (llc->sap, sk);release_sock (sk); -llc_sap_put (sap); }else {release_sock (sk); } -netdev_put (llc->dev, &llc->dev_tracker);sock_put (sk);sock_orphan (sk); sock->sk =NULL ;llc_sk_free (sk); +if (sap) +llc_sap_put (sap); out:return 0 ; }
net/llc/llc_conn.c +5 -4
@@ -942,10 +942,10 @@ void llc_sk_stop_all_timers(struct sock *sk, bool sync)struct llc_sock *llc =llc_sk (sk);if (sync) { -timer_delete_sync (&llc->pf_cycle_timer.timer); -timer_delete_sync (&llc->ack_timer.timer); -timer_delete_sync (&llc->rej_sent_timer.timer); -timer_delete_sync (&llc->busy_state_timer.timer); +timer_shutdown_sync (&llc->pf_cycle_timer.timer); +timer_shutdown_sync (&llc->ack_timer.timer); +timer_shutdown_sync (&llc->rej_sent_timer.timer); +timer_shutdown_sync (&llc->busy_state_timer.timer); }else {timer_delete (&llc->pf_cycle_timer.timer);timer_delete (&llc->ack_timer.timer);
@@ -978,6 +978,7 @@ void llc_sk_free(struct sock *sk)skb_queue_purge (&sk->sk_receive_queue);skb_queue_purge (&sk->sk_write_queue);skb_queue_purge (&llc->pdu_unack_q); +netdev_put (llc->dev, &llc->dev_tracker);#ifdef LLC_REFCNT_DEBUG if (refcount_read (&sk->sk_refcnt) !=1 ) { printk(KERN_DEBUG "Destruction of LLC sock %p delayed in %s, cnt=%d\n",
syzbot
syzbotForwarded: [syzbot control] llc UAF on unpatched 2f2f7eeef8b0
In reply to syzbotFor archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: [syzbot control] llc UAF on unpatched 2f2f7eeef8b0
Author: [email protected]
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git2f2f7eeef8b0a1a9b9ca998231419873ccae8d4e
Control run without a patch. The earlier patched test log showed "Failed to bind: Device or resource busy"; I want to check whether the stock reproducer reaches the bug on this exact commit.
syzbot
syzbotForwarded: [syzbot retest] llc: keep SAP and netdev alive during timer shutdown
In reply to syzbotFor archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: [syzbot retest] llc: keep SAP and netdev alive during timer shutdown
Author: [email protected]
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git2f2f7eeef8b0a1a9b9ca998231419873ccae8d4e
net/llc/af_llc.c +5 -6
@@ -196,6 +196,7 @@ static int llc_ui_release(struct socket *sock) {struct sock *sk = sock->sk;struct llc_sock *llc; +struct llc_sap *sap =NULL ;if (unlikely (sk ==NULL )) goto out;
@@ -207,23 +208,21 @@ static int llc_ui_release(struct socket *sock)if (!llc_send_disc (sk))llc_ui_wait_for_disc (sk,READ_ONCE (sk->sk_rcvtimeo));if (!sock_flag (sk,SOCK_ZAPPED )) { -struct llc_sap *sap = llc->sap; + sap = llc->sap; -/* Hold this for release_sock(), so that llc_backlog_rcv() -* could still use it. -*/ +/* Keep SAP alive through backlog processing and timer shutdown. */ llc_sap_hold (sap);llc_sap_remove_socket (llc->sap, sk);release_sock (sk); -llc_sap_put (sap); }else {release_sock (sk); } -netdev_put (llc->dev, &llc->dev_tracker);sock_put (sk);sock_orphan (sk); sock->sk =NULL ;llc_sk_free (sk); +if (sap) +llc_sap_put (sap); out:return 0 ; }
net/llc/llc_conn.c +5 -4
@@ -942,10 +942,10 @@ void llc_sk_stop_all_timers(struct sock *sk, bool sync)struct llc_sock *llc =llc_sk (sk);if (sync) { -timer_delete_sync (&llc->pf_cycle_timer.timer); -timer_delete_sync (&llc->ack_timer.timer); -timer_delete_sync (&llc->rej_sent_timer.timer); -timer_delete_sync (&llc->busy_state_timer.timer); +timer_shutdown_sync (&llc->pf_cycle_timer.timer); +timer_shutdown_sync (&llc->ack_timer.timer); +timer_shutdown_sync (&llc->rej_sent_timer.timer); +timer_shutdown_sync (&llc->busy_state_timer.timer); }else {timer_delete (&llc->pf_cycle_timer.timer);timer_delete (&llc->ack_timer.timer);
@@ -978,6 +978,7 @@ void llc_sk_free(struct sock *sk)skb_queue_purge (&sk->sk_receive_queue);skb_queue_purge (&sk->sk_write_queue);skb_queue_purge (&llc->pdu_unack_q); +netdev_put (llc->dev, &llc->dev_tracker);#ifdef LLC_REFCNT_DEBUG if (refcount_read (&sk->sk_refcnt) !=1 ) { printk(KERN_DEBUG "Destruction of LLC sock %p delayed in %s, cnt=%d\n",