================================================================== BUG: KASAN: use-after-free in memcpy include/linux/string.h:377 [inline] BUG: KASAN: use-after-free in skb_put_data include/linux/skbuff.h:2130 [inline] BUG: KASAN: use-after-free in bcm_can_tx+0x3d4/0x800 net/can/bcm.c:295 Read of size 72 at addr ffff8880b3656650 by task syz-executor.4/23962 CPU: 0 PID: 23962 Comm: syz-executor.4 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354 kasan_report+0x8f/0xa0 mm/kasan/report.c:412 memcpy+0x20/0x50 mm/kasan/kasan.c:302 memcpy include/linux/string.h:377 [inline] skb_put_data include/linux/skbuff.h:2130 [inline] bcm_can_tx+0x3d4/0x800 net/can/bcm.c:295 bcm_tx_timeout_tsklet+0x1f0/0x3a0 net/can/bcm.c:414 tasklet_action_common.constprop.0+0x265/0x360 kernel/softirq.c:522 __do_softirq+0x265/0x980 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:372 [inline] irq_exit+0x215/0x260 kernel/softirq.c:412 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline] RIP: 0010:qlink_free mm/kasan/quarantine.c:150 [inline] RIP: 0010:qlist_free_all+0xfc/0x140 mm/kasan/quarantine.c:166 Code: 50 08 48 8d 4a ff 83 e2 01 48 0f 45 c1 4c 8b 70 18 e9 40 ff ff ff e8 a3 36 cf ff 48 83 3d e3 0f 59 08 00 74 38 4c 89 ff 57 9d <0f> 1f 44 00 00 4d 85 e4 75 9e 49 c7 45 08 00 00 00 00 49 c7 45 00 RSP: 0018:ffff8880614a7a00 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000007 RBX: ffff888099fafbc0 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff88806b10ee48 RDI: 0000000000000286 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff888099fafa80 R13: ffff8880614a7a38 R14: ffff88823b33e540 R15: 0000000000000286 quarantine_reduce+0x1a9/0x230 mm/kasan/quarantine.c:259 kasan_kmalloc+0xa2/0x160 mm/kasan/kasan.c:538 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] apparmor_sk_alloc_security+0x5c/0xe0 security/apparmor/lsm.c:769 security_sk_alloc+0x50/0xb0 security/security.c:1469 sk_prot_alloc+0x200/0x2d0 net/core/sock.c:1486 sk_alloc+0x36/0xec0 net/core/sock.c:1537 can_create+0x1de/0x470 net/can/af_can.c:174 __sock_create+0x3d8/0x740 net/socket.c:1365 sock_create net/socket.c:1416 [inline] __sys_socket+0xef/0x200 net/socket.c:1458 __do_sys_socket net/socket.c:1467 [inline] __se_sys_socket net/socket.c:1465 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1465 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f92e64d35a9 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f92e4e46168 EFLAGS: 00000246 ORIG_RAX: 0000000000000029 RAX: ffffffffffffffda RBX: 00007f92e65f3f80 RCX: 00007f92e64d35a9 RDX: 0000000000000002 RSI: 0000000000000002 RDI: 000000000000001d RBP: 00007f92e652e580 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe24beaebf R14: 00007f92e4e46300 R15: 0000000000022000 Allocated by task 23943: __do_kmalloc mm/slab.c:3727 [inline] __kmalloc+0x15a/0x3c0 mm/slab.c:3736 kmalloc_array include/linux/slab.h:637 [inline] bcm_tx_setup net/can/bcm.c:957 [inline] bcm_sendmsg+0x316c/0x4150 net/can/bcm.c:1386 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xc3/0x120 net/socket.c:661 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227 __sys_sendmsg net/socket.c:2265 [inline] __do_sys_sendmsg net/socket.c:2274 [inline] __se_sys_sendmsg net/socket.c:2272 [inline] __x64_sys_sendmsg+0x132/0x220 net/socket.c:2272 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 23943: __cache_free mm/slab.c:3503 [inline] kfree+0xcc/0x210 mm/slab.c:3822 bcm_remove_op+0x213/0x2c0 net/can/bcm.c:770 bcm_release+0x260/0x950 net/can/bcm.c:1561 __sock_release+0xcd/0x2a0 net/socket.c:599 sock_close+0x15/0x20 net/socket.c:1214 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0xbf3/0x2be0 kernel/exit.c:870 do_group_exit+0x125/0x310 kernel/exit.c:967 get_signal+0x3f2/0x1f70 kernel/signal.c:2589 do_signal+0x8f/0x1670 arch/x86/kernel/signal.c:799 exit_to_usermode_loop+0x204/0x2a0 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880b36538c0 which belongs to the cache kmalloc-16384 of size 16384 The buggy address is located 11664 bytes inside of 16384-byte region [ffff8880b36538c0, ffff8880b36578c0) The buggy address belongs to the page: page:ffffea0002cd9400 count:1 mapcount:0 mapping:ffff88813bff2200 index:0x0 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffffea00025ebe08 ffff88813bff1c48 ffff88813bff2200 raw: 0000000000000000 ffff8880b36538c0 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880b3656500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880b3656580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880b3656600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880b3656680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880b3656700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 50 push %rax 1: 08 48 8d or %cl,-0x73(%rax) 4: 4a ff 83 e2 01 48 0f rex.WX incq 0xf4801e2(%rbx) b: 45 c1 4c 8b 70 18 rex.RB rorl $0x18,0x70(%r11,%rcx,4) 11: e9 40 ff ff ff jmpq 0xffffff56 16: e8 a3 36 cf ff callq 0xffcf36be 1b: 48 83 3d e3 0f 59 08 cmpq $0x0,0x8590fe3(%rip) # 0x8591006 22: 00 23: 74 38 je 0x5d 25: 4c 89 ff mov %r15,%rdi 28: 57 push %rdi 29: 9d popfq * 2a: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) <-- trapping instruction 2f: 4d 85 e4 test %r12,%r12 32: 75 9e jne 0xffffffd2 34: 49 c7 45 08 00 00 00 movq $0x0,0x8(%r13) 3b: 00 3c: 49 rex.WB 3d: c7 .byte 0xc7 3e: 45 rex.RB