================================================================== BUG: KASAN: slab-out-of-bounds in gb_operation_message_init drivers/greybus/operation.c:341 [inline] BUG: KASAN: slab-out-of-bounds in gb_operation_message_alloc+0x26e/0x2c0 drivers/greybus/operation.c:385 Write of size 2 at addr ffff888013b9f3e2 by task syz.0.17/5925 CPU: 1 UID: 0 PID: 5925 Comm: syz.0.17 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: __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 gb_operation_message_init drivers/greybus/operation.c:341 [inline] gb_operation_message_alloc+0x26e/0x2c0 drivers/greybus/operation.c:385 gb_operation_create_common+0x9f/0x710 drivers/greybus/operation.c:532 gb_operation_create_incoming drivers/greybus/operation.c:644 [inline] gb_connection_recv_request drivers/greybus/operation.c:926 [inline] gb_connection_recv+0x1dc/0x1050 drivers/greybus/operation.c:1063 greybus_data_rcvd+0x244/0x600 drivers/greybus/connection.c:89 cport_in_callback+0x1fb/0x280 drivers/greybus/es2.c:840 __usb_hcd_giveback_urb+0x38e/0x610 drivers/usb/core/hcd.c:1657 usb_hcd_giveback_urb+0x3ca/0x4a0 drivers/usb/core/hcd.c:1741 dummy_timer+0xdb2/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:2019 __run_hrtimer kernel/time/hrtimer.c:2067 [inline] __hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2124 hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2141 handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645 __do_softirq kernel/softirq.c:679 [inline] invoke_softirq kernel/softirq.c:519 [inline] __irq_exit_rcu+0x16a/0x210 kernel/softirq.c:758 irq_exit_rcu+0x9/0x30 kernel/softirq.c:775 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 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 RIP: 0010:check_kcov_mode kernel/kcov.c:181 [inline] RIP: 0010:__sanitizer_cov_trace_pc+0x40/0x70 kernel/kcov.c:213 Code: 80 12 48 63 c8 a9 00 01 00 ff 74 1e f6 c4 01 74 44 a9 00 00 00 0f 75 3d f7 c1 00 00 00 f0 75 35 8b 82 3c 17 00 00 85 c0 74 2b <8b> 82 10 17 00 00 83 f8 02 75 20 48 8b 8a 18 17 00 00 8b 92 14 17 RSP: 0000:ffffc9000330fcf0 EFLAGS: 00000246 RAX: 8000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 RDX: ffff88802a038000 RSI: ffffffff81f6b488 RDI: ffff88802a038000 RBP: ffffc9000330fd50 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000000 R14: 000000000bebc200 R15: dffffc0000000000 trace_hrtimer_setup+0x78/0x220 include/trace/events/timer.h:193 debug_setup_on_stack kernel/time/hrtimer.c:524 [inline] hrtimer_setup_sleeper_on_stack kernel/time/hrtimer.c:2396 [inline] hrtimer_nanosleep+0xad/0x350 kernel/time/hrtimer.c:2473 common_nsleep+0xa1/0xd0 kernel/time/posix-timers.c:1360 __do_sys_clock_nanosleep_time32 kernel/time/posix-timers.c:1434 [inline] __se_sys_clock_nanosleep_time32 kernel/time/posix-timers.c:1411 [inline] __ia32_sys_clock_nanosleep_time32+0x352/0x480 kernel/time/posix-timers.c:1411 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] do_int80_emulation+0x166/0x650 arch/x86/entry/syscall_32.c:166 asm_int80_emulation+0x1a/0x20 arch/x86/include/asm/idtentry.h:598 RIP: 0023:0xf71a75ab Code: 57 56 53 8b 44 24 14 f6 00 08 75 23 8b 44 24 18 8b 5c 24 1c 8b 4c 24 20 8b 54 24 24 8b 74 24 28 8b 7c 24 2c 8b 6c 24 30 cd 80 <5b> 5e 5f 5d c3 5b 5e 5f 5d e9 f7 a1 ff ff 66 90 66 90 66 90 90 53 RSP: 002b:00000000f686438c EFLAGS: 00000246 ORIG_RAX: 000000000000010b RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000000000 RDX: 00000000f6864424 RSI: 00000000f686441c RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 5925: 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] __do_kmalloc_node mm/slub.c:5414 [inline] __kmalloc_noprof+0x32f/0x840 mm/slub.c:5439 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] gb_operation_message_alloc+0x9b/0x2c0 drivers/greybus/operation.c:380 gb_operation_create_common+0x9f/0x710 drivers/greybus/operation.c:532 gb_operation_create_incoming drivers/greybus/operation.c:644 [inline] gb_connection_recv_request drivers/greybus/operation.c:926 [inline] gb_connection_recv+0x1dc/0x1050 drivers/greybus/operation.c:1063 greybus_data_rcvd+0x244/0x600 drivers/greybus/connection.c:89 cport_in_callback+0x1fb/0x280 drivers/greybus/es2.c:840 __usb_hcd_giveback_urb+0x38e/0x610 drivers/usb/core/hcd.c:1657 usb_hcd_giveback_urb+0x3ca/0x4a0 drivers/usb/core/hcd.c:1741 dummy_timer+0xdb2/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:2019 __run_hrtimer kernel/time/hrtimer.c:2067 [inline] __hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2124 hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2141 handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645 __do_softirq kernel/softirq.c:679 [inline] invoke_softirq kernel/softirq.c:519 [inline] __irq_exit_rcu+0x16a/0x210 kernel/softirq.c:758 irq_exit_rcu+0x9/0x30 kernel/softirq.c:775 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 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 The buggy address belongs to the object at ffff888013b9f3e0 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 2 bytes inside of allocated 3-byte region [ffff888013b9f3e0, ffff888013b9f3e3) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888013b9f120 pfn:0x13b9f flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88801c042500 ffffea000093fa10 ffffea0000852290 raw: ffff888013b9f120 0000000000800076 00000000f5000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5865, tgid 5865 (syz-executor), ts 46634677482 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3347 [inline] allocate_slab mm/slub.c:3462 [inline] new_slab+0xa9/0x6e0 mm/slub.c:3513 refill_objects+0xe3/0x410 mm/slub.c:7410 refill_sheaf mm/slub.c:2885 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774 alloc_from_pcs mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:4984 [inline] __do_kmalloc_node mm/slub.c:5413 [inline] __kmalloc_node_track_caller_noprof+0x6a8/0x870 mm/slub.c:5545 __kmemdup_nul mm/util.c:64 [inline] kstrdup+0x51/0xe0 mm/util.c:84 kstrdup_const+0x63/0x80 mm/util.c:104 __kernfs_new_node+0x9b/0xa10 fs/kernfs/dir.c:661 kernfs_new_node fs/kernfs/dir.c:751 [inline] kernfs_create_dir_ns+0xa6/0x2b0 fs/kernfs/dir.c:1120 sysfs_create_dir_ns+0x13a/0x2b0 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x2c8/0x930 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_add+0x16a/0x1e0 lib/kobject.c:426 device_add+0x294/0x1970 drivers/base/core.c:3699 netdev_register_kobject+0x1df/0x410 net/core/net-sysfs.c:2340 page last free pid 5865 tgid 5865 ts 46561283457 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1418 [inline] __free_frozen_pages+0x79f/0x10f0 mm/page_alloc.c:2962 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:4683 [inline] slab_alloc_node mm/slub.c:4996 [inline] kmem_cache_alloc_noprof+0x269/0x6a0 mm/slub.c:5010 alloc_empty_file+0x5b/0x1c0 fs/file_table.c:262 alloc_file fs/file_table.c:396 [inline] alloc_file_pseudo+0x183/0x290 fs/file_table.c:427 sock_alloc_file+0x50/0x210 net/socket.c:557 sock_map_fd net/socket.c:587 [inline] __sys_socket+0x1c0/0x260 net/socket.c:1827 __do_compat_sys_socketcall net/compat.c:447 [inline] __se_compat_sys_socketcall net/compat.c:422 [inline] __ia32_compat_sys_socketcall+0x65b/0x770 net/compat.c:422 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Memory state around the buggy address: ffff888013b9f280: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc ffff888013b9f300: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc >ffff888013b9f380: fa fc fc fc fa fc fc fc fa fc fc fc 03 fc fc fc ^ ffff888013b9f400: fa fc fc fc fa fc fc fc 06 fc fc fc 06 fc fc fc ffff888013b9f480: fa fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 80 12 48 adcb $0x48,(%rdx) 3: 63 c8 movsxd %eax,%ecx 5: a9 00 01 00 ff test $0xff000100,%eax a: 74 1e je 0x2a c: f6 c4 01 test $0x1,%ah f: 74 44 je 0x55 11: a9 00 00 00 0f test $0xf000000,%eax 16: 75 3d jne 0x55 18: f7 c1 00 00 00 f0 test $0xf0000000,%ecx 1e: 75 35 jne 0x55 20: 8b 82 3c 17 00 00 mov 0x173c(%rdx),%eax 26: 85 c0 test %eax,%eax 28: 74 2b je 0x55 * 2a: 8b 82 10 17 00 00 mov 0x1710(%rdx),%eax <-- trapping instruction 30: 83 f8 02 cmp $0x2,%eax 33: 75 20 jne 0x55 35: 48 8b 8a 18 17 00 00 mov 0x1718(%rdx),%rcx 3c: 8b .byte 0x8b 3d: 92 xchg %eax,%edx 3e: 14 17 adc $0x17,%al