Re: KMSAN: uninit-value in ax88172a_bind
Hello, syzbot has tested the proposed patch but the reproducer still triggered crash: kernel BUG at drivers/net/phy/mdio_bus.c:LINE! asix 5-1:0.78 eth1: unregister 'asix' usb-dummy_hcd.4-1, ASIX AX88172A USB 2.0 Ethernet asix 5-1:0.78 eth1 (unregistered): deregistering mdio bus ��# [ cut here ] kernel BUG at drivers/net/phy/mdio_bus.c:453! invalid opcode: [#1] SMP CPU: 1 PID: 11855 Comm: kworker/1:4 Not tainted 5.4.0-rc2+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: usb_hub_wq hub_event RIP: 0010:mdiobus_unregister+0x2e3/0x350 drivers/net/phy/mdio_bus.c:453 Code: e8 d2 d2 5f fe eb 3b 8b 7d d4 e8 68 d2 9c fb e9 78 fd ff ff 8b 3a e8 5c d2 9c fb 41 83 fe 02 0f 84 93 fd ff ff e8 ad 26 38 fb <0f> 0b 44 89 f7 e8 43 d2 9c fb 4d 85 ff 75 a5 e8 99 26 38 fb 48 8b RSP: 0018:88808e80f3f0 EFLAGS: 00010293 RAX: 8669e193 RBX: RCX: 888090ed3c80 RDX: RSI: ea0002c4d310 RDI: 8dc3c318 RBP: 88808e80f448 R08: 0002 R09: 88821fc99c38 R10: 0004 R11: 866687b0 R12: 88808dc3c318 R13: R14: 1e392680 R15: 888090ed4628 FS: () GS:88812fd0() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 007136b4 CR3: 8b8fd000 CR4: 001406e0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Call Trace: ax88172a_remove_mdio drivers/net/usb/ax88172a.c:124 [inline] ax88172a_unbind+0x119/0x1a0 drivers/net/usb/ax88172a.c:274 usbnet_disconnect+0x209/0x660 drivers/net/usb/usbnet.c:1611 usb_unbind_interface+0x3a2/0xdd0 drivers/usb/core/driver.c:423 __device_release_driver drivers/base/dd.c:1134 [inline] device_release_driver_internal+0x96f/0xd80 drivers/base/dd.c:1165 device_release_driver+0x4b/0x60 drivers/base/dd.c:1188 bus_remove_device+0x4bf/0x670 drivers/base/bus.c:532 device_del+0xcd5/0x1cb0 drivers/base/core.c:2375 usb_disable_device+0x567/0x1150 drivers/usb/core/message.c:1241 usb_disconnect+0x51e/0xd60 drivers/usb/core/hub.c:2199 hub_port_connect drivers/usb/core/hub.c:4949 [inline] hub_port_connect_change drivers/usb/core/hub.c:5213 [inline] port_event drivers/usb/core/hub.c:5359 [inline] hub_event+0x3fd0/0x72f0 drivers/usb/core/hub.c:5441 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415 kthread+0x4b5/0x4f0 kernel/kthread.c:256 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355 Modules linked in: ---[ end trace c2dc0f9345a55089 ]--- RIP: 0010:mdiobus_unregister+0x2e3/0x350 drivers/net/phy/mdio_bus.c:453 Code: e8 d2 d2 5f fe eb 3b 8b 7d d4 e8 68 d2 9c fb e9 78 fd ff ff 8b 3a e8 5c d2 9c fb 41 83 fe 02 0f 84 93 fd ff ff e8 ad 26 38 fb <0f> 0b 44 89 f7 e8 43 d2 9c fb 4d 85 ff 75 a5 e8 99 26 38 fb 48 8b RSP: 0018:88808e80f3f0 EFLAGS: 00010293 RAX: 8669e193 RBX: RCX: 888090ed3c80 RDX: RSI: ea0002c4d310 RDI: 8dc3c318 RBP: 88808e80f448 R08: 0002 R09: 88821fc99c38 R10: 0004 R11: 866687b0 R12: 88808dc3c318 R13: R14: 1e392680 R15: 888090ed4628 FS: () GS:88812fd0() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 007136b4 CR3: 8b8fd000 CR4: 001406e0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Tested on: commit: fa169025 kmsan: get rid of unused static functions in kmsa.. git tree: https://github.com/google/kmsan.git console output: https://syzkaller.appspot.com/x/log.txt?x=17a128cf60 kernel config: https://syzkaller.appspot.com/x/.config?x=49548798e87d32d7 dashboard link: https://syzkaller.appspot.com/bug?extid=a8d4acdad35e6bbca308 compiler: clang version 9.0.0 (/home/glider/llvm/clang 80fee25776c2fb61e74c1ecb1a523375c2500b69) patch: https://syzkaller.appspot.com/x/patch.diff?x=131a322760
Re: KMSAN: uninit-value in ax88172a_bind
Am Montag, den 14.10.2019, 22:10 -0700 schrieb syzbot: > Hello, > > syzbot found the following crash on: > > HEAD commit:fa169025 kmsan: get rid of unused static functions in kmsa.. > git tree: https://github.com/google/kmsan.git master > console output: https://syzkaller.appspot.com/x/log.txt?x=1432a65360 > kernel config: https://syzkaller.appspot.com/x/.config?x=49548798e87d32d7 > dashboard link: https://syzkaller.appspot.com/bug?extid=a8d4acdad35e6bbca308 > compiler: clang version 9.0.0 (/home/glider/llvm/clang > 80fee25776c2fb61e74c1ecb1a523375c2500b69) > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14743a6f60 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=125bdbc760 > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > Reported-by: syzbot+a8d4acdad35e6bbca...@syzkaller.appspotmail.com #syz test: https://github.com/google/kmsan.git fa169025 From a6fd7a04a330a8bfad836b20843ea5fe26e0ae38 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 17 Oct 2019 15:12:33 +0200 Subject: [PATCH] asix: fix information leak on short answers If a malicious device gives a short MAC it can elicit up to 5 bytes of leaked memory out of the driver. We need to check for ETH_ALEN. Signed-off-by: Oliver Neukum --- drivers/net/usb/ax88172a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c index 011bd4cb546e..af3994e0853b 100644 --- a/drivers/net/usb/ax88172a.c +++ b/drivers/net/usb/ax88172a.c @@ -196,7 +196,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf) /* Get the MAC address */ ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); - if (ret < 0) { + if (ret < ETH_ALEN) { netdev_err(dev->net, "Failed to read MAC address: %d\n", ret); goto free; } -- 2.16.4
KMSAN: uninit-value in ax88172a_bind
Hello, syzbot found the following crash on: HEAD commit:fa169025 kmsan: get rid of unused static functions in kmsa.. git tree: https://github.com/google/kmsan.git master console output: https://syzkaller.appspot.com/x/log.txt?x=1432a65360 kernel config: https://syzkaller.appspot.com/x/.config?x=49548798e87d32d7 dashboard link: https://syzkaller.appspot.com/bug?extid=a8d4acdad35e6bbca308 compiler: clang version 9.0.0 (/home/glider/llvm/clang 80fee25776c2fb61e74c1ecb1a523375c2500b69) syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14743a6f60 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=125bdbc760 IMPORTANT: if you fix the bug, please add the following tag to the commit: Reported-by: syzbot+a8d4acdad35e6bbca...@syzkaller.appspotmail.com usb 1-1: config 0 has no interface number 0 usb 1-1: New USB device found, idVendor=0b95, idProduct=172a, bcdDevice=9b.e9 usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 usb 1-1: config 0 descriptor?? = BUG: KMSAN: uninit-value in ax88172a_bind+0x76d/0xf80 drivers/net/usb/ax88172a.c:217 CPU: 1 PID: 3632 Comm: kworker/1:2 Not tainted 5.4.0-rc2+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x191/0x1f0 lib/dump_stack.c:113 kmsan_report+0x14e/0x2c0 mm/kmsan/kmsan_report.c:110 __msan_warning+0x73/0xe0 mm/kmsan/kmsan_instr.c:245 ax88172a_bind+0x76d/0xf80 drivers/net/usb/ax88172a.c:217 usbnet_probe+0x10d3/0x39d0 drivers/net/usb/usbnet.c:1730 usb_probe_interface+0xd19/0x1310 drivers/usb/core/driver.c:361 really_probe+0xd91/0x1f90 drivers/base/dd.c:552 driver_probe_device+0x1ba/0x510 drivers/base/dd.c:721 __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:828 bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:430 __device_attach+0x489/0x750 drivers/base/dd.c:894 device_initial_probe+0x4a/0x60 drivers/base/dd.c:941 bus_probe_device+0x131/0x390 drivers/base/bus.c:490 device_add+0x25b5/0x2df0 drivers/base/core.c:2201 usb_set_configuration+0x309f/0x3710 drivers/usb/core/message.c:2027 generic_probe+0xe7/0x280 drivers/usb/core/generic.c:210 usb_probe_device+0x146/0x200 drivers/usb/core/driver.c:266 really_probe+0xd91/0x1f90 drivers/base/dd.c:552 driver_probe_device+0x1ba/0x510 drivers/base/dd.c:721 __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:828 bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:430 __device_attach+0x489/0x750 drivers/base/dd.c:894 device_initial_probe+0x4a/0x60 drivers/base/dd.c:941 bus_probe_device+0x131/0x390 drivers/base/bus.c:490 device_add+0x25b5/0x2df0 drivers/base/core.c:2201 usb_new_device+0x23e5/0x2fb0 drivers/usb/core/hub.c:2536 hub_port_connect drivers/usb/core/hub.c:5098 [inline] hub_port_connect_change drivers/usb/core/hub.c:5213 [inline] port_event drivers/usb/core/hub.c:5359 [inline] hub_event+0x581d/0x72f0 drivers/usb/core/hub.c:5441 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415 kthread+0x4b5/0x4f0 kernel/kthread.c:256 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355 Local variable description: buf@ax88172a_bind Variable was created at: ax88172a_bind+0x66/0xf80 drivers/net/usb/ax88172a.c:186 ax88172a_bind+0x66/0xf80 drivers/net/usb/ax88172a.c:186 = --- This bug 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 syzkal...@googlegroups.com. syzbot will keep track of this bug report. See: https://goo.gl/tpsmEJ#status for how to communicate with syzbot. syzbot can test patches for this bug, for details see: https://goo.gl/tpsmEJ#testing-patches