bisecting cause commit starting from 7ae77150d94d3b535c7b85e6b3647113095e79bf building syzkaller on 81abc33188b4caf19873b9676ab1d8dc0e3511ca testing commit 7ae77150d94d3b535c7b85e6b3647113095e79bf with gcc (GCC) 8.1.0 kernel signature: 5379e05deee9fb8af71745de5fd0efaf29d72d699aca641f2f2a36c2b05934fa all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id testing release v5.7 testing commit 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 with gcc (GCC) 8.1.0 kernel signature: 5b4798cd1a719a8c451b66fa2738dd59e329b48863bb158fd2d57f3b97309c10 all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id testing release v5.6 testing commit 7111951b8d4973bda27ff663f2cf18b663d15b48 with gcc (GCC) 8.1.0 kernel signature: 3a036433fa02de5e8d5bae294e25fc607ea594b497f7292e152d07d400df4108 all runs: OK # git bisect start 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 7111951b8d4973bda27ff663f2cf18b663d15b48 Bisecting: 7542 revisions left to test after this (roughly 13 steps) [50a5de895dbe5df947b3a695777db5b2c313e065] Merge tag 'for-linus-hmm' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma testing commit 50a5de895dbe5df947b3a695777db5b2c313e065 with gcc (GCC) 8.1.0 kernel signature: f1579660791eaeba4fdb13786c55c23cc54c95911da673a9bb6d9ce5bab79255 all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad 50a5de895dbe5df947b3a695777db5b2c313e065 Bisecting: 4204 revisions left to test after this (roughly 12 steps) [56a451b780676bc1cdac011735fe2869fa2e9abf] Merge tag 'ntb-5.7' of git://github.com/jonmason/ntb testing commit 56a451b780676bc1cdac011735fe2869fa2e9abf with gcc (GCC) 8.1.0 kernel signature: 8beb60754ea42efa69593a624b9a67f97c05b5dbcb153913eb71d096d75a0a36 all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad 56a451b780676bc1cdac011735fe2869fa2e9abf Bisecting: 1643 revisions left to test after this (roughly 11 steps) [49835c15a55225e9b3ff9cc9317135b334ea2d49] Merge tag 'pm-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm testing commit 49835c15a55225e9b3ff9cc9317135b334ea2d49 with gcc (GCC) 8.1.0 kernel signature: ecd511e7e4524fd03b9ad00335fa3909b37c141ba1c8ea090c37355733df9d29 all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad 49835c15a55225e9b3ff9cc9317135b334ea2d49 Bisecting: 934 revisions left to test after this (roughly 10 steps) [063d1942247668eb0bb800aef5afbbef337344be] Merge tag 'media/v5.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media testing commit 063d1942247668eb0bb800aef5afbbef337344be with gcc (GCC) 8.1.0 kernel signature: 37e65149c9b895f8e68cbdae4f12de2a970a896b64abb1a8810beb60f9a92d7a all runs: OK # git bisect good 063d1942247668eb0bb800aef5afbbef337344be Bisecting: 516 revisions left to test after this (roughly 9 steps) [e681bb287f40e7a9dbcb04cef80fd87a2511ab86] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code testing commit e681bb287f40e7a9dbcb04cef80fd87a2511ab86 with gcc (GCC) 8.1.0 kernel signature: fb72d76675a6556dbbc426066fdc1476a49bec46067727685468f870a3c0abc5 all runs: OK # git bisect good e681bb287f40e7a9dbcb04cef80fd87a2511ab86 Bisecting: 266 revisions left to test after this (roughly 8 steps) [db34c5ffee649e2c4c870d1031a996398a187cf5] Merge tag 'usb-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb testing commit db34c5ffee649e2c4c870d1031a996398a187cf5 with gcc (GCC) 8.1.0 kernel signature: 665b2f6a05c37013be94e53586df30c4869779c4f2a173944cee736d1b87c492 all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad db34c5ffee649e2c4c870d1031a996398a187cf5 Bisecting: 121 revisions left to test after this (roughly 7 steps) [a8ab3e76297ea85d92f4ee0833bd469816a13ccf] Merge tag 'usb-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next testing commit a8ab3e76297ea85d92f4ee0833bd469816a13ccf with gcc (GCC) 8.1.0 kernel signature: 7f8c37704c75c633797e7981888402e8aa23ebb53b6b7f4b22690c50f24a84e5 all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad a8ab3e76297ea85d92f4ee0833bd469816a13ccf Bisecting: 63 revisions left to test after this (roughly 6 steps) [d1c6a769cdf466053ae211789f2b0671c8a72331] usb: typec: mux: Allow the mux handles to be requested with fwnode testing commit d1c6a769cdf466053ae211789f2b0671c8a72331 with gcc (GCC) 8.1.0 kernel signature: e93fdaa1bcaef28bdc8be302468a56b22a08fd468987d6d1f78630d0bc39fc6c all runs: OK # git bisect good d1c6a769cdf466053ae211789f2b0671c8a72331 Bisecting: 31 revisions left to test after this (roughly 5 steps) [eeead847487f726fa177d0f4060c4f0816ad9cd9] usb: gadget: amd5536udc: fix spelling mistake "reserverd" -> "reserved" testing commit eeead847487f726fa177d0f4060c4f0816ad9cd9 with gcc (GCC) 8.1.0 kernel signature: eb362da812853040fc5cc54c77692007998ef7d7e0720e911d1dcee4863597bb all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad eeead847487f726fa177d0f4060c4f0816ad9cd9 Bisecting: 15 revisions left to test after this (roughly 4 steps) [3d157c28d2289edf0439e8308e8de3a06acaaf0e] doc: dt: bindings: usb: dwc3: Update entries for disabling SS instances in park mode testing commit 3d157c28d2289edf0439e8308e8de3a06acaaf0e with gcc (GCC) 8.1.0 kernel signature: 3fec564ce70e91527740ad3c32cf5dc4df47b2f58ed18eaa91e4edb452a5f223 all runs: OK # git bisect good 3d157c28d2289edf0439e8308e8de3a06acaaf0e Bisecting: 7 revisions left to test after this (roughly 3 steps) [0227cc84c44417a29c8102e41db8ec2c11ebc6b2] usb: dwc3: core: don't do suspend for device mode if already suspended testing commit 0227cc84c44417a29c8102e41db8ec2c11ebc6b2 with gcc (GCC) 8.1.0 kernel signature: f141b946dc3d67289bf49b866029e561bc19bcc2750ccac2f3b1ae51cbfcc813 all runs: OK # git bisect good 0227cc84c44417a29c8102e41db8ec2c11ebc6b2 Bisecting: 3 revisions left to test after this (roughly 2 steps) [95b18f28979e12539cc02f6ec4e2c776e8551f39] dt-bindings: usb: dwc2: add compatible property for rk3328 usb testing commit 95b18f28979e12539cc02f6ec4e2c776e8551f39 with gcc (GCC) 8.1.0 kernel signature: e042a9cc5a339ddc4f9edb436014ce18bdf2514fe9a9fc44eb99e7618810953e all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad 95b18f28979e12539cc02f6ec4e2c776e8551f39 Bisecting: 1 revision left to test after this (roughly 1 step) [1a0808cb9e417170ed6ab97254cf319dc3e3c310] usb: dwc2: Implement set_selfpowered() testing commit 1a0808cb9e417170ed6ab97254cf319dc3e3c310 with gcc (GCC) 8.1.0 kernel signature: 2daa76d31095960726a566ad9d76eb3d8583a3b3f2e0aa58a94d6276263c2250 all runs: OK # git bisect good 1a0808cb9e417170ed6ab97254cf319dc3e3c310 Bisecting: 0 revisions left to test after this (roughly 0 steps) [f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10] usb: gadget: add raw-gadget interface testing commit f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10 with gcc (GCC) 8.1.0 kernel signature: d4df4b71357882a5be2005c94023f6ac5606abbb1b347c63ca6f18ccb3752903 all runs: crashed: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id # git bisect bad f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10 f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10 is the first bad commit commit f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10 Author: Andrey Konovalov Date: Mon Feb 24 17:13:03 2020 +0100 usb: gadget: add raw-gadget interface USB Raw Gadget is a kernel module that provides a userspace interface for the USB Gadget subsystem. Essentially it allows to emulate USB devices from userspace. Enabled with CONFIG_USB_RAW_GADGET. Raw Gadget is currently a strictly debugging feature and shouldn't be used in production. Raw Gadget is similar to GadgetFS, but provides a more low-level and direct access to the USB Gadget layer for the userspace. The key differences are: 1. Every USB request is passed to the userspace to get a response, while GadgetFS responds to some USB requests internally based on the provided descriptors. However note, that the UDC driver might respond to some requests on its own and never forward them to the Gadget layer. 2. GadgetFS performs some sanity checks on the provided USB descriptors, while Raw Gadget allows you to provide arbitrary data as responses to USB requests. 3. Raw Gadget provides a way to select a UDC device/driver to bind to, while GadgetFS currently binds to the first available UDC. 4. Raw Gadget uses predictable endpoint names (handles) across different UDCs (as long as UDCs have enough endpoints of each required transfer type). 5. Raw Gadget has ioctl-based interface instead of a filesystem-based one. Reviewed-by: Greg Kroah-Hartman Signed-off-by: Andrey Konovalov Signed-off-by: Felipe Balbi Documentation/usb/index.rst | 1 + Documentation/usb/raw-gadget.rst | 61 ++ drivers/usb/gadget/legacy/Kconfig | 11 + drivers/usb/gadget/legacy/Makefile | 1 + drivers/usb/gadget/legacy/raw_gadget.c | 1078 ++++++++++++++++++++++++++++++++ include/uapi/linux/usb/raw_gadget.h | 167 +++++ 6 files changed, 1319 insertions(+) create mode 100644 Documentation/usb/raw-gadget.rst create mode 100644 drivers/usb/gadget/legacy/raw_gadget.c create mode 100644 include/uapi/linux/usb/raw_gadget.h culprit signature: d4df4b71357882a5be2005c94023f6ac5606abbb1b347c63ca6f18ccb3752903 parent signature: 2daa76d31095960726a566ad9d76eb3d8583a3b3f2e0aa58a94d6276263c2250 revisions tested: 17, total time: 3h29m16.560120664s (build: 1h43m47.102001986s, test: 1h44m13.524616708s) first bad commit: f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10 usb: gadget: add raw-gadget interface cc: ["andreyknvl@google.com" "balbi@kernel.org" "gregkh@linuxfoundation.org"] crash: KASAN: slab-out-of-bounds Write in snd_usb_mixer_notify_id ================================================================== BUG: KASAN: slab-out-of-bounds in snd_usb_mixer_notify_id+0x106/0x160 sound/usb/mixer.c:3175 Write of size 4 at addr ffff88809fde77e0 by task kworker/u4:7/441 CPU: 0 PID: 441 Comm: kworker/u4:7 Not tainted 5.6.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events_unbound call_usermodehelper_exec_work Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x128/0x182 lib/dump_stack.c:118 print_address_description.constprop.8.cold.10+0x9/0x317 mm/kasan/report.c:374 __kasan_report.cold.11+0x1c/0x34 mm/kasan/report.c:506 kasan_report+0xe/0x20 mm/kasan/common.c:641 snd_usb_mixer_notify_id+0x106/0x160 sound/usb/mixer.c:3175 snd_usb_mixer_interrupt+0x462/0x720 sound/usb/mixer.c:3312 __usb_hcd_giveback_urb+0x1d9/0x370 drivers/usb/core/hcd.c:1648 dummy_timer+0xfe6/0x2b10 drivers/usb/gadget/udc/dummy_hcd.c:1966 call_timer_fn+0x167/0x570 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] run_timer_softirq+0xc8c/0x1170 kernel/time/timer.c:1786 __do_softirq+0x26e/0x9b2 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x191/0x1d0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:546 [inline] smp_apic_timer_interrupt+0x1a1/0x5f0 arch/x86/kernel/apic/apic.c:1146 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829 RIP: 0010:__percpu_down_read+0x0/0xe0 kernel/locking/percpu-rwsem.c:45 Code: 48 c7 43 60 00 00 00 00 5b 5d c3 48 89 ef e8 57 79 4b 00 eb a5 48 89 ef e8 cd 79 4b 00 eb e1 48 89 ef e8 43 79 4b 00 eb b7 90 <55> 53 48 89 fb 48 83 ec 08 f0 83 44 24 fc 00 48 81 c7 f8 00 00 00 RSP: 0018:ffffc900021379b8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000002 RBX: 0000000000000011 RCX: 0000000000000000 RDX: 1ffffffff1179318 RSI: 0000000000000000 RDI: ffffffff88bc98c0 RBP: ffffc90002137b40 R08: ffffed1015d0707c R09: ffffed1015d0707c R10: ffffed1015d0707b R11: ffff8880ae8383db R12: 0000000000808100 R13: ffff8880a3b544bc R14: ffff8880a3b54040 R15: ffff8880a3b54758 percpu_down_read include/linux/percpu-rwsem.h:53 [inline] cgroup_threadgroup_change_begin include/linux/cgroup-defs.h:727 [inline] copy_process+0x4d7d/0x6a40 kernel/fork.c:2177 _do_fork+0xf8/0xc00 kernel/fork.c:2430 kernel_thread+0x98/0xd0 kernel/fork.c:2517 call_usermodehelper_exec_work+0x189/0x210 kernel/umh.c:195 process_one_work+0x903/0x15c0 kernel/workqueue.c:2264 worker_thread+0x82/0xb50 kernel/workqueue.c:2410 kthread+0x31d/0x3e0 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Allocated by task 2779: save_stack+0x19/0x80 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] __kasan_kmalloc.constprop.17+0xc1/0xd0 mm/kasan/common.c:515 kmem_cache_alloc_trace+0x156/0x780 mm/slab.c:3551 kmalloc include/linux/slab.h:555 [inline] kzalloc include/linux/slab.h:669 [inline] add_single_ctl_with_resume+0x55/0x1b0 sound/usb/mixer_quirks.c:146 snd_mbox1_create_sync_switch sound/usb/mixer_quirks.c:718 [inline] snd_usb_mixer_apply_create_quirk+0x111f/0x1930 sound/usb/mixer_quirks.c:2234 snd_usb_create_mixer+0x743/0x18e0 sound/usb/mixer.c:3471 create_composite_quirk+0x18c/0x3b0 sound/usb/quirks.c:48 usb_audio_probe+0x492/0x1c90 sound/usb/card.c:650 usb_probe_interface+0x268/0x6c0 drivers/usb/core/driver.c:361 really_probe+0x1f9/0x5e0 drivers/base/dd.c:551 driver_probe_device+0xc9/0x1b0 drivers/base/dd.c:724 bus_for_each_drv+0x117/0x1a0 drivers/base/bus.c:431 __device_attach+0x1be/0x2c0 drivers/base/dd.c:897 bus_probe_device+0x19e/0x250 drivers/base/bus.c:491 device_add+0x10d0/0x1900 drivers/base/core.c:2500 usb_set_configuration+0xc02/0x1560 drivers/usb/core/message.c:2023 generic_probe+0x61/0x8a drivers/usb/core/generic.c:210 really_probe+0x1f9/0x5e0 drivers/base/dd.c:551 driver_probe_device+0xc9/0x1b0 drivers/base/dd.c:724 bus_for_each_drv+0x117/0x1a0 drivers/base/bus.c:431 __device_attach+0x1be/0x2c0 drivers/base/dd.c:897 bus_probe_device+0x19e/0x250 drivers/base/bus.c:491 device_add+0x10d0/0x1900 drivers/base/core.c:2500 usb_new_device.cold.66+0x679/0xe85 drivers/usb/core/hub.c:2548 hub_port_connect drivers/usb/core/hub.c:5195 [inline] hub_port_connect_change drivers/usb/core/hub.c:5335 [inline] port_event drivers/usb/core/hub.c:5481 [inline] hub_event+0x15fe/0x2d60 drivers/usb/core/hub.c:5563 process_one_work+0x903/0x15c0 kernel/workqueue.c:2264 worker_thread+0x82/0xb50 kernel/workqueue.c:2410 kthread+0x31d/0x3e0 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Freed by task 2779: save_stack+0x19/0x80 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] kasan_set_free_info mm/kasan/common.c:337 [inline] __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:476 __cache_free mm/slab.c:3426 [inline] kfree+0x107/0x2b0 mm/slab.c:3757 free_work+0x48/0x60 mm/vmalloc.c:66 process_one_work+0x903/0x15c0 kernel/workqueue.c:2264 worker_thread+0x82/0xb50 kernel/workqueue.c:2410 kthread+0x31d/0x3e0 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 The buggy address belongs to the object at ffff88809fde7780 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 32 bytes to the right of 64-byte region [ffff88809fde7780, ffff88809fde77c0) The buggy address belongs to the page: page:ffffea00027f79c0 refcount:1 mapcount:0 mapping:ffff8880aa400380 index:0x0 flags: 0xfffe0000000200(slab) raw: 00fffe0000000200 ffffea0002816cc8 ffffea0002600148 ffff8880aa400380 raw: 0000000000000000 ffff88809fde7000 0000000100000020 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809fde7680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88809fde7700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88809fde7780: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ^ ffff88809fde7800: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88809fde7880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ==================================================================