* usb/media/uvc: warning in uvc_scan_chain_forward/__list_add @ 2017-09-25 12:40 Andrey Konovalov 2017-09-26 8:43 ` Laurent Pinchart 0 siblings, 1 reply; 5+ messages in thread From: Andrey Konovalov @ 2017-09-25 12:40 UTC (permalink / raw) To: Laurent Pinchart, Mauro Carvalho Chehab, linux-media, LKML Cc: Dmitry Vyukov, Kostya Serebryany, syzkaller Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit e19b205be43d11bff638cad4487008c48d21c103 (4.14-rc2). list_add double add: new=ffff880069084010, prev=ffff880069084010, next=ffff880067d22298. ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 __list_add_valid+0xbd/0xf0 Modules linked in: CPU: 1 PID: 1846 Comm: kworker/1:2 Not tainted 4.14.0-rc2-42613-g1488251d1a98 #238 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Workqueue: usb_hub_wq hub_event task: ffff88006b01ca40 task.stack: ffff880064358000 RIP: 0010:__list_add_valid+0xbd/0xf0 lib/list_debug.c:29 RSP: 0018:ffff88006435ddd0 EFLAGS: 00010286 RAX: 0000000000000058 RBX: ffff880067d22298 RCX: 0000000000000000 RDX: 0000000000000058 RSI: ffffffff85a58800 RDI: ffffed000c86bbac RBP: ffff88006435dde8 R08: 1ffff1000c86ba52 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000000 R12: ffff880069084010 R13: ffff880067d22298 R14: ffff880069084010 R15: ffff880067d222a0 FS: 0000000000000000(0000) GS:ffff88006c900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020004ff2 CR3: 000000006b447000 CR4: 00000000000006e0 Call Trace: __list_add ./include/linux/list.h:59 list_add_tail+0x8c/0x1b0 ./include/linux/list.h:92 uvc_scan_chain_forward.isra.8+0x373/0x416 drivers/media/usb/uvc/uvc_driver.c:1471 uvc_scan_chain drivers/media/usb/uvc/uvc_driver.c:1585 uvc_scan_device drivers/media/usb/uvc/uvc_driver.c:1769 uvc_probe+0x77f2/0x8f00 drivers/media/usb/uvc/uvc_driver.c:2104 usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 hub_port_connect drivers/usb/core/hub.c:4903 hub_port_connect_change drivers/usb/core/hub.c:5009 port_event drivers/usb/core/hub.c:5115 hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 worker_thread+0x221/0x1850 kernel/workqueue.c:2253 kthread+0x3a1/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 Code: f1 48 c7 c7 c0 89 a5 85 48 89 de e8 38 34 e1 fe 0f ff 31 c0 eb c3 48 89 f2 48 89 d9 4c 89 e6 48 c7 c7 40 8a a5 85 e8 1d 34 e1 fe <0f> ff 31 c0 eb a8 48 89 75 e8 e8 e4 b3 2a ff 48 8b 75 e8 e9 5b ---[ end trace 23181469b7a6915e ]--- ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: usb/media/uvc: warning in uvc_scan_chain_forward/__list_add 2017-09-25 12:40 usb/media/uvc: warning in uvc_scan_chain_forward/__list_add Andrey Konovalov @ 2017-09-26 8:43 ` Laurent Pinchart 2017-09-26 12:41 ` Andrey Konovalov 0 siblings, 1 reply; 5+ messages in thread From: Laurent Pinchart @ 2017-09-26 8:43 UTC (permalink / raw) To: Andrey Konovalov Cc: Mauro Carvalho Chehab, linux-media, LKML, Dmitry Vyukov, Kostya Serebryany, syzkaller Hi Andrey, On Monday, 25 September 2017 15:40:13 EEST Andrey Konovalov wrote: > Hi! > > I've got the following report while fuzzing the kernel with syzkaller. Thank you for the report. > On commit e19b205be43d11bff638cad4487008c48d21c103 (4.14-rc2). > > list_add double add: new=ffff880069084010, prev=ffff880069084010, > next=ffff880067d22298. > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 __list_add_valid+0xbd/0xf0 > Modules linked in: > CPU: 1 PID: 1846 Comm: kworker/1:2 Not tainted > 4.14.0-rc2-42613-g1488251d1a98 #238 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 > Workqueue: usb_hub_wq hub_event > task: ffff88006b01ca40 task.stack: ffff880064358000 > RIP: 0010:__list_add_valid+0xbd/0xf0 lib/list_debug.c:29 > RSP: 0018:ffff88006435ddd0 EFLAGS: 00010286 > RAX: 0000000000000058 RBX: ffff880067d22298 RCX: 0000000000000000 > RDX: 0000000000000058 RSI: ffffffff85a58800 RDI: ffffed000c86bbac > RBP: ffff88006435dde8 R08: 1ffff1000c86ba52 R09: 0000000000000000 > R10: 0000000000000002 R11: 0000000000000000 R12: ffff880069084010 > R13: ffff880067d22298 R14: ffff880069084010 R15: ffff880067d222a0 > FS: 0000000000000000(0000) GS:ffff88006c900000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 0000000020004ff2 CR3: 000000006b447000 CR4: 00000000000006e0 > Call Trace: > __list_add ./include/linux/list.h:59 > list_add_tail+0x8c/0x1b0 ./include/linux/list.h:92 > uvc_scan_chain_forward.isra.8+0x373/0x416 > drivers/media/usb/uvc/uvc_driver.c:1471 > uvc_scan_chain drivers/media/usb/uvc/uvc_driver.c:1585 > uvc_scan_device drivers/media/usb/uvc/uvc_driver.c:1769 > uvc_probe+0x77f2/0x8f00 drivers/media/usb/uvc/uvc_driver.c:2104 So the issue happens at probe time, before the driver registers the V4L2 device nodes that allow userspace access to the device. I wonder how fuzzing caused this. Do you have a more detailed log ? Could you also tell me what webcam you're using to test this out ? The output of lsusb -v would be useful. > usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 > really_probe drivers/base/dd.c:413 > driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 > __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 > bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 > __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 > device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 > bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 > device_add+0xd0b/0x1660 drivers/base/core.c:1835 > usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 > generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 > usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 > really_probe drivers/base/dd.c:413 > driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 > __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 > bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 > __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 > device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 > bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 > device_add+0xd0b/0x1660 drivers/base/core.c:1835 > usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 > hub_port_connect drivers/usb/core/hub.c:4903 > hub_port_connect_change drivers/usb/core/hub.c:5009 > port_event drivers/usb/core/hub.c:5115 > hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 > process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 > worker_thread+0x221/0x1850 kernel/workqueue.c:2253 > kthread+0x3a1/0x470 kernel/kthread.c:231 > ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 > Code: f1 48 c7 c7 c0 89 a5 85 48 89 de e8 38 34 e1 fe 0f ff 31 c0 eb > c3 48 89 f2 48 89 d9 4c 89 e6 48 c7 c7 40 8a a5 85 e8 1d 34 e1 fe <0f> > ff 31 c0 eb a8 48 89 75 e8 e8 e4 b3 2a ff 48 8b 75 e8 e9 5b > ---[ end trace 23181469b7a6915e ]--- -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: usb/media/uvc: warning in uvc_scan_chain_forward/__list_add 2017-09-26 8:43 ` Laurent Pinchart @ 2017-09-26 12:41 ` Andrey Konovalov 2017-09-26 12:50 ` Laurent Pinchart 0 siblings, 1 reply; 5+ messages in thread From: Andrey Konovalov @ 2017-09-26 12:41 UTC (permalink / raw) To: Laurent Pinchart Cc: Mauro Carvalho Chehab, linux-media, LKML, Dmitry Vyukov, Kostya Serebryany, syzkaller On Tue, Sep 26, 2017 at 10:43 AM, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > Hi Andrey, > > On Monday, 25 September 2017 15:40:13 EEST Andrey Konovalov wrote: >> Hi! >> >> I've got the following report while fuzzing the kernel with syzkaller. > > Thank you for the report. > >> On commit e19b205be43d11bff638cad4487008c48d21c103 (4.14-rc2). >> >> list_add double add: new=ffff880069084010, prev=ffff880069084010, >> next=ffff880067d22298. >> ------------[ cut here ]------------ >> WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 __list_add_valid+0xbd/0xf0 >> Modules linked in: >> CPU: 1 PID: 1846 Comm: kworker/1:2 Not tainted >> 4.14.0-rc2-42613-g1488251d1a98 #238 >> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 >> Workqueue: usb_hub_wq hub_event >> task: ffff88006b01ca40 task.stack: ffff880064358000 >> RIP: 0010:__list_add_valid+0xbd/0xf0 lib/list_debug.c:29 >> RSP: 0018:ffff88006435ddd0 EFLAGS: 00010286 >> RAX: 0000000000000058 RBX: ffff880067d22298 RCX: 0000000000000000 >> RDX: 0000000000000058 RSI: ffffffff85a58800 RDI: ffffed000c86bbac >> RBP: ffff88006435dde8 R08: 1ffff1000c86ba52 R09: 0000000000000000 >> R10: 0000000000000002 R11: 0000000000000000 R12: ffff880069084010 >> R13: ffff880067d22298 R14: ffff880069084010 R15: ffff880067d222a0 >> FS: 0000000000000000(0000) GS:ffff88006c900000(0000) knlGS:0000000000000000 >> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 >> CR2: 0000000020004ff2 CR3: 000000006b447000 CR4: 00000000000006e0 >> Call Trace: >> __list_add ./include/linux/list.h:59 >> list_add_tail+0x8c/0x1b0 ./include/linux/list.h:92 >> uvc_scan_chain_forward.isra.8+0x373/0x416 >> drivers/media/usb/uvc/uvc_driver.c:1471 >> uvc_scan_chain drivers/media/usb/uvc/uvc_driver.c:1585 >> uvc_scan_device drivers/media/usb/uvc/uvc_driver.c:1769 >> uvc_probe+0x77f2/0x8f00 drivers/media/usb/uvc/uvc_driver.c:2104 > > So the issue happens at probe time, before the driver registers the V4L2 > device nodes that allow userspace access to the device. I wonder how fuzzing > caused this. Do you have a more detailed log ? > > Could you also tell me what webcam you're using to test this out ? The output > of lsusb -v would be useful. Hi Laurent, I fuzz the USB stack externally by emulating random USB devices via dummy_hcd and gadgetfs. lsusb -v doesn't show anything, since the USB device doesn't finish initialization. Since I'm able to reproduce this, I can collect debug traces for you. Here's a part of the log around the warning report: gadgetfs: bound to dummy_udc driver usb 1-1: new full-speed USB device number 2 using dummy_hcd gadgetfs: connected gadgetfs: disconnected gadgetfs: connected usb 1-1: config 3 has an invalid interface number: 3 but max is 0 usb 1-1: config 3 contains an unexpected descriptor of type 0x1, skipping usb 1-1: config 3 has an invalid descriptor of length 208, skipping remainder of the config usb 1-1: config 3 has no interface number 0 usb 1-1: New USB device found, idVendor=07f5, idProduct=03ff usb 1-1: New USB device strings: Mfr=83, Product=255, SerialNumber=5 usb 1-1: Product: a usb 1-1: Manufacturer: a usb 1-1: SerialNumber: a gadgetfs: configuration #3 uvcvideo: Found UVC 0.00 device a (07f5:03ff) list_add double add: new=ffff880069a64910, prev=ffff880069a64910, next=ffff8800698468d8. ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 __list_add_valid+0xbd/0xf0 ... ---[ end trace ea45186b02846d5a ]--- uvcvideo 1-1:3.3: Entity type for entity a was not initialized! gadgetfs: disconnected usb 1-1: USB disconnect, device number 2 Thanks! > >> usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 >> really_probe drivers/base/dd.c:413 >> driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 >> __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 >> bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 >> __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 >> device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 >> bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 >> device_add+0xd0b/0x1660 drivers/base/core.c:1835 >> usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 >> generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 >> usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 >> really_probe drivers/base/dd.c:413 >> driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 >> __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 >> bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 >> __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 >> device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 >> bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 >> device_add+0xd0b/0x1660 drivers/base/core.c:1835 >> usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 >> hub_port_connect drivers/usb/core/hub.c:4903 >> hub_port_connect_change drivers/usb/core/hub.c:5009 >> port_event drivers/usb/core/hub.c:5115 >> hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 >> process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 >> worker_thread+0x221/0x1850 kernel/workqueue.c:2253 >> kthread+0x3a1/0x470 kernel/kthread.c:231 >> ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 >> Code: f1 48 c7 c7 c0 89 a5 85 48 89 de e8 38 34 e1 fe 0f ff 31 c0 eb >> c3 48 89 f2 48 89 d9 4c 89 e6 48 c7 c7 40 8a a5 85 e8 1d 34 e1 fe <0f> >> ff 31 c0 eb a8 48 89 75 e8 e8 e4 b3 2a ff 48 8b 75 e8 e9 5b >> ---[ end trace 23181469b7a6915e ]--- > > -- > Regards, > > Laurent Pinchart > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: usb/media/uvc: warning in uvc_scan_chain_forward/__list_add 2017-09-26 12:41 ` Andrey Konovalov @ 2017-09-26 12:50 ` Laurent Pinchart 2017-09-26 14:17 ` Andrey Konovalov 0 siblings, 1 reply; 5+ messages in thread From: Laurent Pinchart @ 2017-09-26 12:50 UTC (permalink / raw) To: Andrey Konovalov Cc: Mauro Carvalho Chehab, linux-media, LKML, Dmitry Vyukov, Kostya Serebryany, syzkaller Hi Andrey, On Tuesday, 26 September 2017 15:41:45 EEST Andrey Konovalov wrote: > On Tue, Sep 26, 2017 at 10:43 AM, Laurent Pinchart wrote: > > On Monday, 25 September 2017 15:40:13 EEST Andrey Konovalov wrote: > >> Hi! > >> > >> I've got the following report while fuzzing the kernel with syzkaller. > > > > Thank you for the report. > > > >> On commit e19b205be43d11bff638cad4487008c48d21c103 (4.14-rc2). > >> > >> list_add double add: new=ffff880069084010, prev=ffff880069084010, > >> next=ffff880067d22298. > >> ------------[ cut here ]------------ > >> WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 > >> __list_add_valid+0xbd/0xf0 > >> Modules linked in: > >> CPU: 1 PID: 1846 Comm: kworker/1:2 Not tainted > >> 4.14.0-rc2-42613-g1488251d1a98 #238 > >> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs > >> 01/01/2011 Workqueue: usb_hub_wq hub_event > >> task: ffff88006b01ca40 task.stack: ffff880064358000 > >> RIP: 0010:__list_add_valid+0xbd/0xf0 lib/list_debug.c:29 > >> RSP: 0018:ffff88006435ddd0 EFLAGS: 00010286 > >> RAX: 0000000000000058 RBX: ffff880067d22298 RCX: 0000000000000000 > >> RDX: 0000000000000058 RSI: ffffffff85a58800 RDI: ffffed000c86bbac > >> RBP: ffff88006435dde8 R08: 1ffff1000c86ba52 R09: 0000000000000000 > >> R10: 0000000000000002 R11: 0000000000000000 R12: ffff880069084010 > >> R13: ffff880067d22298 R14: ffff880069084010 R15: ffff880067d222a0 > >> FS: 0000000000000000(0000) GS:ffff88006c900000(0000) > >> knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > >> CR2: 0000000020004ff2 CR3: 000000006b447000 CR4: 00000000000006e0 > >> > >> Call Trace: > >> __list_add ./include/linux/list.h:59 > >> list_add_tail+0x8c/0x1b0 ./include/linux/list.h:92 > >> uvc_scan_chain_forward.isra.8+0x373/0x416 > >> > >> drivers/media/usb/uvc/uvc_driver.c:1471 > >> > >> uvc_scan_chain drivers/media/usb/uvc/uvc_driver.c:1585 > >> uvc_scan_device drivers/media/usb/uvc/uvc_driver.c:1769 > >> uvc_probe+0x77f2/0x8f00 drivers/media/usb/uvc/uvc_driver.c:2104 > > > > So the issue happens at probe time, before the driver registers the V4L2 > > device nodes that allow userspace access to the device. I wonder how > > fuzzing caused this. Do you have a more detailed log ? > > > > Could you also tell me what webcam you're using to test this out ? The > > output of lsusb -v would be useful. > > Hi Laurent, > > I fuzz the USB stack externally by emulating random USB devices via > dummy_hcd and gadgetfs. Ah that makes more sense indeed. > lsusb -v doesn't show anything, since the USB device doesn't finish > initialization. > > Since I'm able to reproduce this, I can collect debug traces for you. Could you send me the descriptors that your gadget driver returns to the host ? If that's difficult, as an alternative, could you enable tracing in the uvcvideo driver (uvcvideo.trace=0xffff on the kernel commmand line for instance) and send me the kernel log ? > Here's a part of the log around the warning report: > > gadgetfs: bound to dummy_udc driver > usb 1-1: new full-speed USB device number 2 using dummy_hcd > gadgetfs: connected > gadgetfs: disconnected > gadgetfs: connected > usb 1-1: config 3 has an invalid interface number: 3 but max is 0 > usb 1-1: config 3 contains an unexpected descriptor of type 0x1, skipping > usb 1-1: config 3 has an invalid descriptor of length 208, skipping > remainder of the config > usb 1-1: config 3 has no interface number 0 > usb 1-1: New USB device found, idVendor=07f5, idProduct=03ff > usb 1-1: New USB device strings: Mfr=83, Product=255, SerialNumber=5 > usb 1-1: Product: a > usb 1-1: Manufacturer: a > usb 1-1: SerialNumber: a > gadgetfs: configuration #3 > uvcvideo: Found UVC 0.00 device a (07f5:03ff) > list_add double add: new=ffff880069a64910, prev=ffff880069a64910, > next=ffff8800698468d8. > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 __list_add_valid+0xbd/0xf0 > ... > ---[ end trace ea45186b02846d5a ]--- > uvcvideo 1-1:3.3: Entity type for entity a was not initialized! > gadgetfs: disconnected > usb 1-1: USB disconnect, device number 2 > > Thanks! > > >> usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 > >> really_probe drivers/base/dd.c:413 > >> driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 > >> __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 > >> bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 > >> __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 > >> device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 > >> bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 > >> device_add+0xd0b/0x1660 drivers/base/core.c:1835 > >> usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 > >> generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 > >> usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 > >> really_probe drivers/base/dd.c:413 > >> driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 > >> __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 > >> bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 > >> __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 > >> device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 > >> bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 > >> device_add+0xd0b/0x1660 drivers/base/core.c:1835 > >> usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 > >> hub_port_connect drivers/usb/core/hub.c:4903 > >> hub_port_connect_change drivers/usb/core/hub.c:5009 > >> port_event drivers/usb/core/hub.c:5115 > >> hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 > >> process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 > >> worker_thread+0x221/0x1850 kernel/workqueue.c:2253 > >> kthread+0x3a1/0x470 kernel/kthread.c:231 > >> ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 > >> > >> Code: f1 48 c7 c7 c0 89 a5 85 48 89 de e8 38 34 e1 fe 0f ff 31 c0 eb > >> c3 48 89 f2 48 89 d9 4c 89 e6 48 c7 c7 40 8a a5 85 e8 1d 34 e1 fe <0f> > >> ff 31 c0 eb a8 48 89 75 e8 e8 e4 b3 2a ff 48 8b 75 e8 e9 5b > >> ---[ end trace 23181469b7a6915e ]--- -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: usb/media/uvc: warning in uvc_scan_chain_forward/__list_add 2017-09-26 12:50 ` Laurent Pinchart @ 2017-09-26 14:17 ` Andrey Konovalov 0 siblings, 0 replies; 5+ messages in thread From: Andrey Konovalov @ 2017-09-26 14:17 UTC (permalink / raw) To: Laurent Pinchart Cc: Mauro Carvalho Chehab, linux-media, LKML, Dmitry Vyukov, Kostya Serebryany, syzkaller [-- Attachment #1: Type: text/plain, Size: 7866 bytes --] On Tue, Sep 26, 2017 at 2:50 PM, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > Hi Andrey, > > On Tuesday, 26 September 2017 15:41:45 EEST Andrey Konovalov wrote: >> On Tue, Sep 26, 2017 at 10:43 AM, Laurent Pinchart wrote: >> > On Monday, 25 September 2017 15:40:13 EEST Andrey Konovalov wrote: >> >> Hi! >> >> >> >> I've got the following report while fuzzing the kernel with syzkaller. >> > >> > Thank you for the report. >> > >> >> On commit e19b205be43d11bff638cad4487008c48d21c103 (4.14-rc2). >> >> >> >> list_add double add: new=ffff880069084010, prev=ffff880069084010, >> >> next=ffff880067d22298. >> >> ------------[ cut here ]------------ >> >> WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 >> >> __list_add_valid+0xbd/0xf0 >> >> Modules linked in: >> >> CPU: 1 PID: 1846 Comm: kworker/1:2 Not tainted >> >> 4.14.0-rc2-42613-g1488251d1a98 #238 >> >> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs >> >> 01/01/2011 Workqueue: usb_hub_wq hub_event >> >> task: ffff88006b01ca40 task.stack: ffff880064358000 >> >> RIP: 0010:__list_add_valid+0xbd/0xf0 lib/list_debug.c:29 >> >> RSP: 0018:ffff88006435ddd0 EFLAGS: 00010286 >> >> RAX: 0000000000000058 RBX: ffff880067d22298 RCX: 0000000000000000 >> >> RDX: 0000000000000058 RSI: ffffffff85a58800 RDI: ffffed000c86bbac >> >> RBP: ffff88006435dde8 R08: 1ffff1000c86ba52 R09: 0000000000000000 >> >> R10: 0000000000000002 R11: 0000000000000000 R12: ffff880069084010 >> >> R13: ffff880067d22298 R14: ffff880069084010 R15: ffff880067d222a0 >> >> FS: 0000000000000000(0000) GS:ffff88006c900000(0000) >> >> knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 >> >> CR2: 0000000020004ff2 CR3: 000000006b447000 CR4: 00000000000006e0 >> >> >> >> Call Trace: >> >> __list_add ./include/linux/list.h:59 >> >> list_add_tail+0x8c/0x1b0 ./include/linux/list.h:92 >> >> uvc_scan_chain_forward.isra.8+0x373/0x416 >> >> >> >> drivers/media/usb/uvc/uvc_driver.c:1471 >> >> >> >> uvc_scan_chain drivers/media/usb/uvc/uvc_driver.c:1585 >> >> uvc_scan_device drivers/media/usb/uvc/uvc_driver.c:1769 >> >> uvc_probe+0x77f2/0x8f00 drivers/media/usb/uvc/uvc_driver.c:2104 >> > >> > So the issue happens at probe time, before the driver registers the V4L2 >> > device nodes that allow userspace access to the device. I wonder how >> > fuzzing caused this. Do you have a more detailed log ? >> > >> > Could you also tell me what webcam you're using to test this out ? The >> > output of lsusb -v would be useful. >> >> Hi Laurent, >> >> I fuzz the USB stack externally by emulating random USB devices via >> dummy_hcd and gadgetfs. > > Ah that makes more sense indeed. > >> lsusb -v doesn't show anything, since the USB device doesn't finish >> initialization. >> >> Since I'm able to reproduce this, I can collect debug traces for you. > > Could you send me the descriptors that your gadget driver returns to the host > ? If that's difficult, as an alternative, could you enable tracing in the > uvcvideo driver (uvcvideo.trace=0xffff on the kernel commmand line for > instance) and send me the kernel log ? The log with uvcvideo.trace=0xffff is below. Also attaching usbmon trace. gadgetfs: bound to dummy_udc driver usb 1-1: new full-speed USB device number 2 using dummy_hcd gadgetfs: connected gadgetfs: disconnected gadgetfs: connected usb 1-1: config 3 has an invalid interface number: 3 but max is 0 usb 1-1: config 3 contains an unexpected descriptor of type 0x1, skipping usb 1-1: config 3 has an invalid descriptor of length 208, skipping remainder of the config usb 1-1: config 3 has no interface number 0 usb 1-1: New USB device found, idVendor=07f5, idProduct=03ff usb 1-1: New USB device strings: Mfr=83, Product=255, SerialNumber=5 usb 1-1: Product: a usb 1-1: Manufacturer: a usb 1-1: SerialNumber: a gadgetfs: configuration #3 uvcvideo: Probing generic UVC device 1 uvcvideo: Found UVC 0.00 device a (07f5:03ff) uvcvideo: Scanning UVC chain: OT 0 list_add double add: new=ffff880061ca3a90, prev=ffff880061ca3a90, next=ffff88006b3f48d8. ------------[ cut here ]------------ ... ---[ end trace e2bce247826f5cdb ]--- (-> OT 0) uvcvideo: Found a valid video chain ( -> 0). uvcvideo 1-1:3.3: Entity type for entity a was not initialized! uvcvideo: UVC device initialized. gadgetfs: disconnected usb 1-1: USB disconnect, device number 2 > >> Here's a part of the log around the warning report: >> >> gadgetfs: bound to dummy_udc driver >> usb 1-1: new full-speed USB device number 2 using dummy_hcd >> gadgetfs: connected >> gadgetfs: disconnected >> gadgetfs: connected >> usb 1-1: config 3 has an invalid interface number: 3 but max is 0 >> usb 1-1: config 3 contains an unexpected descriptor of type 0x1, skipping >> usb 1-1: config 3 has an invalid descriptor of length 208, skipping >> remainder of the config >> usb 1-1: config 3 has no interface number 0 >> usb 1-1: New USB device found, idVendor=07f5, idProduct=03ff >> usb 1-1: New USB device strings: Mfr=83, Product=255, SerialNumber=5 >> usb 1-1: Product: a >> usb 1-1: Manufacturer: a >> usb 1-1: SerialNumber: a >> gadgetfs: configuration #3 >> uvcvideo: Found UVC 0.00 device a (07f5:03ff) >> list_add double add: new=ffff880069a64910, prev=ffff880069a64910, >> next=ffff8800698468d8. >> ------------[ cut here ]------------ >> WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 __list_add_valid+0xbd/0xf0 >> ... >> ---[ end trace ea45186b02846d5a ]--- >> uvcvideo 1-1:3.3: Entity type for entity a was not initialized! >> gadgetfs: disconnected >> usb 1-1: USB disconnect, device number 2 >> >> Thanks! >> >> >> usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 >> >> really_probe drivers/base/dd.c:413 >> >> driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 >> >> __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 >> >> bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 >> >> __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 >> >> device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 >> >> bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 >> >> device_add+0xd0b/0x1660 drivers/base/core.c:1835 >> >> usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 >> >> generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 >> >> usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 >> >> really_probe drivers/base/dd.c:413 >> >> driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 >> >> __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 >> >> bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 >> >> __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 >> >> device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 >> >> bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 >> >> device_add+0xd0b/0x1660 drivers/base/core.c:1835 >> >> usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 >> >> hub_port_connect drivers/usb/core/hub.c:4903 >> >> hub_port_connect_change drivers/usb/core/hub.c:5009 >> >> port_event drivers/usb/core/hub.c:5115 >> >> hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 >> >> process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 >> >> worker_thread+0x221/0x1850 kernel/workqueue.c:2253 >> >> kthread+0x3a1/0x470 kernel/kthread.c:231 >> >> ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 >> >> >> >> Code: f1 48 c7 c7 c0 89 a5 85 48 89 de e8 38 34 e1 fe 0f ff 31 c0 eb >> >> c3 48 89 f2 48 89 d9 4c 89 e6 48 c7 c7 40 8a a5 85 e8 1d 34 e1 fe <0f> >> >> ff 31 c0 eb a8 48 89 75 e8 e8 e4 b3 2a ff 48 8b 75 e8 e9 5b >> >> ---[ end trace 23181469b7a6915e ]--- > > -- > Regards, > > Laurent Pinchart > > -- > You received this message because you are subscribed to the Google Groups "syzkaller" group. > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. [-- Attachment #2: uvc_scan_chain-warn-usbmon --] [-- Type: application/octet-stream, Size: 4395 bytes --] ffff880069d7b100 30101811 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff880069d7b100 30102614 C Ci:1:001:0 0 4 = 01010100 ffff880069d7b300 30102801 S Co:1:001:0 s 23 01 0010 0001 0000 0 ffff880069d7b300 30104045 C Co:1:001:0 0 0 ffff88006b3d6100 30220297 S Ii:1:001:1 -115:2048 4 < ffff880069d7b500 30220656 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff880069d7b500 30220967 C Ci:1:001:0 0 4 = 01010000 ffff880069d7b000 30222254 S Co:1:001:0 s 23 03 0004 0001 0000 0 ffff880069d7b000 30223842 C Co:1:001:0 0 0 ffff880069d7b900 30300319 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b3d6100 30301585 C Ii:1:001:1 0:2048 1 = 02 ffff88006b3d6100 30301634 S Ii:1:001:1 -115:2048 4 < ffff880069d7b900 30302898 C Ci:1:001:0 0 4 = 03011000 ffff880069d7b200 30303225 S Co:1:001:0 s 23 01 0014 0001 0000 0 ffff880069d7b200 30303536 C Co:1:001:0 0 0 ffff880069d7b400 30372402 S Ci:1:000:0 s 80 06 0100 0000 0040 64 < ffff880069d7b400 30391374 C Ci:1:000:0 0 18 = 12010002 01000040 f507ff03 040053ff 0501 ffff880069d7b600 30392662 S Co:1:001:0 s 23 03 0004 0001 0000 0 ffff880069d7b600 30394930 C Co:1:001:0 0 0 ffff880069c63000 30470265 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b3d6100 30470402 C Ii:1:001:1 0:2048 1 = 02 ffff88006b3d6100 30470433 S Ii:1:001:1 -115:2048 4 < ffff880069c63000 30470772 C Ci:1:001:0 0 4 = 03011000 ffff880069c63200 30470887 S Co:1:001:0 s 23 01 0014 0001 0000 0 ffff880069c63200 30471072 C Co:1:001:0 0 0 ffff880069c63300 30540267 S Co:1:000:0 s 00 05 0002 0000 0000 0 ffff880069c63300 30560142 C Co:1:000:0 0 0 ffff880069c63400 30590276 S Ci:1:002:0 s 80 06 0100 0000 0012 18 < ffff880069c63400 30611215 C Ci:1:002:0 0 18 = 12010002 01000040 f507ff03 040053ff 0501 ffff880069c63600 30611661 S Ci:1:002:0 s 80 06 0600 0000 000a 10 < ffff880069c63600 30630157 C Ci:1:002:0 -32 0 ffff880069c63500 30630347 S Ci:1:002:0 s 80 06 0600 0000 000a 10 < ffff880069c63500 30650160 C Ci:1:002:0 -32 0 ffff880069c63900 30650334 S Ci:1:002:0 s 80 06 0600 0000 000a 10 < ffff880069c63900 30670163 C Ci:1:002:0 -32 0 ffff880069c63a00 30670553 S Ci:1:002:0 s 80 06 0200 0000 0009 9 < ffff880069c63a00 30690170 C Ci:1:002:0 0 9 = 09028f00 01030080 00 ffff880069c63e00 30690378 S Ci:1:002:0 s 80 06 0200 0000 008f 143 < ffff880069c63e00 30710169 C Ci:1:002:0 0 143 = 09028f00 01030080 00090403 00000e01 00000924 03000103 7c003328 010204db ffff88006a49d300 30724434 S Ci:1:002:0 s 80 06 0300 0000 00ff 255 < ffff88006a49d300 30760170 C Ci:1:002:0 0 4 = 04030904 ffff88006a49d100 30760376 S Ci:1:002:0 s 80 06 03ff 0409 00ff 255 < ffff88006a49d100 30800169 C Ci:1:002:0 0 4 = 04036100 ffff88006a49d400 30800529 S Ci:1:002:0 s 80 06 0353 0409 00ff 255 < ffff88006a49d400 30840172 C Ci:1:002:0 0 4 = 04036100 ffff88006a49d500 30840534 S Ci:1:002:0 s 80 06 0305 0409 00ff 255 < ffff88006a49d500 30880159 C Ci:1:002:0 0 4 = 04036100 ffff88006a49d600 30892860 S Co:1:002:0 s 00 09 0003 0000 0000 0 ffff88006a49d600 30930190 C Co:1:002:0 0 0 ffff88006a49d700 30935641 S Ci:1:002:0 s 80 06 0333 0409 00ff 255 < ffff88006a49d700 30980170 C Ci:1:002:0 0 4 = 04036100 ffff88006a49d800 31174408 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006a49d800 31174488 C Ci:1:001:0 0 4 = 03010000 ffff88006b3d6100 31564657 C Ii:1:001:1 0:2048 1 = 02 ffff88006b3d6100 31564736 S Ii:1:001:1 -115:2048 4 < ffff88006b67b200 31565849 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b3d6100 31565998 C Ii:1:001:1 0:2048 1 = 02 ffff88006b3d6100 31566036 S Ii:1:001:1 -115:2048 4 < ffff88006b67b200 31566061 C Ci:1:001:0 0 4 = 00010100 ffff88006b67b300 31566215 S Co:1:001:0 s 23 01 0010 0001 0000 0 ffff88006b67b300 31566691 C Co:1:001:0 0 0 ffff88006b67bf00 31582057 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b67bf00 31582359 C Ci:1:001:0 0 4 = 00010000 ffff88006b67bd00 31630248 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b67bd00 31630349 C Ci:1:001:0 0 4 = 00010000 ffff88006b67bb00 31680244 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b67bb00 31680362 C Ci:1:001:0 0 4 = 00010000 ffff88006b67b400 31730262 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b67b400 31730381 C Ci:1:001:0 0 4 = 00010000 ffff88006b67be00 31780239 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b67be00 31780359 C Ci:1:001:0 0 4 = 00010000 ffff88006b67bc00 31780503 S Ci:1:001:0 s a3 00 0000 0001 0004 4 < ffff88006b67bc00 31780595 C Ci:1:001:0 0 4 = 00010000 ffff88006b3d6100 31780758 C Ii:1:001:1 -2:2048 0 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-26 14:17 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-09-25 12:40 usb/media/uvc: warning in uvc_scan_chain_forward/__list_add Andrey Konovalov 2017-09-26 8:43 ` Laurent Pinchart 2017-09-26 12:41 ` Andrey Konovalov 2017-09-26 12:50 ` Laurent Pinchart 2017-09-26 14:17 ` Andrey Konovalov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).