syzbot


KMSAN: kernel-infoleak in raw_ioctl

Status: fixed on 2020/09/25 01:17
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+a7e220df5a81d1ab400e@syzkaller.appspotmail.com
Fix commit: a092b7233f0e net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
First crash: 1355d, last: 1330d
Discussions (15)
Title Replies (including bot) Last reply
[PATCH 4.4 00/62] 4.4.236-rc1 review 66 (66) 2020/09/12 08:08
[PATCH 4.9 00/71] 4.9.236-rc1 review 75 (75) 2020/09/12 08:06
[PATCH 5.8 000/186] 5.8.8-rc1 review 198 (198) 2020/09/10 13:47
[PATCH 5.4 000/129] 5.4.64-rc1 review 135 (135) 2020/09/09 16:40
[PATCH 4.14 00/65] 4.14.197-rc1 review 70 (70) 2020/09/09 16:39
[PATCH 4.19 00/88] 4.19.144-rc1 review 99 (99) 2020/09/09 16:39
[PATCH AUTOSEL 5.8 01/53] ARC: HSDK: wireup perf irq 55 (55) 2020/09/07 22:24
[PATCH AUTOSEL 4.4 01/10] drivers/net/wan/lapbether: Added needed_tailroom 10 (10) 2020/09/07 16:35
[PATCH AUTOSEL 4.9 01/13] drivers/net/wan/lapbether: Added needed_tailroom 13 (13) 2020/09/07 16:35
[PATCH AUTOSEL 4.14 01/17] ARC: HSDK: wireup perf irq 17 (17) 2020/09/07 16:35
[PATCH AUTOSEL 4.19 01/26] ARC: HSDK: wireup perf irq 26 (26) 2020/09/07 16:34
[PATCH AUTOSEL 5.4 01/43] ARC: HSDK: wireup perf irq 43 (43) 2020/09/07 16:33
[PATCH] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() 5 (5) 2020/08/28 11:06
[PATCH] net: usb: Fix uninit-was-stored issue in asix_read_cmd() 14 (14) 2020/08/25 15:44
KMSAN: kernel-infoleak in raw_ioctl 9 (11) 2020/08/19 06:33
Last patch testing requests (2)
Created Duration User Patch Repo Result
2020/08/26 12:45 20m himadrispandya@gmail.com patch https://github.com/google/kmsan.git master OK
2020/08/22 11:40 20m himadrispandya@gmail.com patch https://github.com/google/kmsan.git master OK

Sample crash report:
=====================================================
BUG: KMSAN: kernel-infoleak in kmsan_copy_to_user+0x81/0x90 mm/kmsan/kmsan_hooks.c:253
CPU: 0 PID: 8469 Comm: syz-executor131 Not tainted 5.8.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x21c/0x280 lib/dump_stack.c:118
 kmsan_report+0xf7/0x1e0 mm/kmsan/kmsan_report.c:121
 kmsan_internal_check_memory+0x238/0x3d0 mm/kmsan/kmsan.c:423
 kmsan_copy_to_user+0x81/0x90 mm/kmsan/kmsan_hooks.c:253
 instrument_copy_to_user include/linux/instrumented.h:91 [inline]
 _copy_to_user+0x18e/0x260 lib/usercopy.c:39
 copy_to_user include/linux/uaccess.h:186 [inline]
 raw_ioctl_event_fetch drivers/usb/gadget/legacy/raw_gadget.c:567 [inline]
 raw_ioctl+0x4995/0x5810 drivers/usb/gadget/legacy/raw_gadget.c:1213
 vfs_ioctl fs/ioctl.c:48 [inline]
 ksys_ioctl fs/ioctl.c:753 [inline]
 __do_sys_ioctl fs/ioctl.c:762 [inline]
 __se_sys_ioctl+0x319/0x4d0 fs/ioctl.c:760
 __x64_sys_ioctl+0x4a/0x70 fs/ioctl.c:760
 do_syscall_64+0xad/0x160 arch/x86/entry/common.c:386
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x444cf7
Code: Bad RIP value.
RSP: 002b:00007ffd7306dca8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000444cf7
RDX: 00007ffd7306ecd0 RSI: 0000000080085502 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000019
R10: 0000000000000075 R11: 0000000000000246 R12: 00000000004029f0
R13: 0000000000402a80 R14: 0000000000000000 R15: 0000000000000000

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:144 [inline]
 kmsan_internal_chain_origin+0xad/0x130 mm/kmsan/kmsan.c:310
 kmsan_memcpy_memmove_metadata+0x272/0x2e0 mm/kmsan/kmsan.c:247
 kmsan_memcpy_metadata+0xb/0x10 mm/kmsan/kmsan.c:267
 __msan_memcpy+0x43/0x50 mm/kmsan/kmsan_instr.c:116
 raw_event_queue_add drivers/usb/gadget/legacy/raw_gadget.c:74 [inline]
 raw_queue_event+0x2b3/0x5c0 drivers/usb/gadget/legacy/raw_gadget.c:225
 gadget_setup+0x48c/0x530 drivers/usb/gadget/legacy/raw_gadget.c:343
 dummy_timer+0x2c4d/0x71c0 drivers/usb/gadget/udc/dummy_hcd.c:1899
 call_timer_fn+0x226/0x550 kernel/time/timer.c:1404
 expire_timers+0x4fc/0x780 kernel/time/timer.c:1449
 __run_timers+0xaf4/0xd30 kernel/time/timer.c:1773
 run_timer_softirq+0x2d/0x50 kernel/time/timer.c:1786
 __do_softirq+0x2ea/0x7f5 kernel/softirq.c:293

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:144 [inline]
 kmsan_internal_chain_origin+0xad/0x130 mm/kmsan/kmsan.c:310
 __msan_chain_origin+0x50/0x90 mm/kmsan/kmsan_instr.c:165
 dummy_timer+0x1d82/0x71c0 drivers/usb/gadget/udc/dummy_hcd.c:1867
 call_timer_fn+0x226/0x550 kernel/time/timer.c:1404
 expire_timers+0x4fc/0x780 kernel/time/timer.c:1449
 __run_timers+0xaf4/0xd30 kernel/time/timer.c:1773
 run_timer_softirq+0x2d/0x50 kernel/time/timer.c:1786
 __do_softirq+0x2ea/0x7f5 kernel/softirq.c:293

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:144 [inline]
 kmsan_internal_chain_origin+0xad/0x130 mm/kmsan/kmsan.c:310
 __msan_chain_origin+0x50/0x90 mm/kmsan/kmsan_instr.c:165
 usb_control_msg+0x5df/0x820 drivers/usb/core/message.c:149
 __usbnet_write_cmd drivers/net/usb/usbnet.c:2035 [inline]
 usbnet_write_cmd+0x3de/0x480 drivers/net/usb/usbnet.c:2073
 asix_write_cmd+0x18b/0x2c0 drivers/net/usb/asix_common.c:48
 ax88772_hw_reset+0x1bd/0xc30 drivers/net/usb/asix_devices.c:361
 ax88772_bind+0x8f3/0x1400 drivers/net/usb/asix_devices.c:730
 usbnet_probe+0x1152/0x3f90 drivers/net/usb/usbnet.c:1737
 usb_probe_interface+0xece/0x1550 drivers/usb/core/driver.c:374
 really_probe+0xf20/0x20b0 drivers/base/dd.c:529
 driver_probe_device+0x293/0x390 drivers/base/dd.c:701
 __device_attach_driver+0x63f/0x830 drivers/base/dd.c:807
 bus_for_each_drv+0x2ca/0x3f0 drivers/base/bus.c:431
 __device_attach+0x4e2/0x7f0 drivers/base/dd.c:873
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:920
 bus_probe_device+0x177/0x3d0 drivers/base/bus.c:491
 device_add+0x3b0e/0x40d0 drivers/base/core.c:2680
 usb_set_configuration+0x380f/0x3f10 drivers/usb/core/message.c:2032
 usb_generic_driver_probe+0x138/0x300 drivers/usb/core/generic.c:241
 usb_probe_device+0x311/0x490 drivers/usb/core/driver.c:272
 really_probe+0xf20/0x20b0 drivers/base/dd.c:529
 driver_probe_device+0x293/0x390 drivers/base/dd.c:701
 __device_attach_driver+0x63f/0x830 drivers/base/dd.c:807
 bus_for_each_drv+0x2ca/0x3f0 drivers/base/bus.c:431
 __device_attach+0x4e2/0x7f0 drivers/base/dd.c:873
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:920
 bus_probe_device+0x177/0x3d0 drivers/base/bus.c:491
 device_add+0x3b0e/0x40d0 drivers/base/core.c:2680
 usb_new_device+0x1bd4/0x2a30 drivers/usb/core/hub.c:2554
 hub_port_connect drivers/usb/core/hub.c:5208 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5348 [inline]
 port_event drivers/usb/core/hub.c:5494 [inline]
 hub_event+0x5e7b/0x8a70 drivers/usb/core/hub.c:5576
 process_one_work+0x1688/0x2140 kernel/workqueue.c:2269
 worker_thread+0x10bc/0x2730 kernel/workqueue.c:2415
 kthread+0x551/0x590 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:144 [inline]
 kmsan_internal_chain_origin+0xad/0x130 mm/kmsan/kmsan.c:310
 __msan_chain_origin+0x50/0x90 mm/kmsan/kmsan_instr.c:165
 ax88772_bind+0x82e/0x1400 drivers/net/usb/asix_devices.c:720
 usbnet_probe+0x1152/0x3f90 drivers/net/usb/usbnet.c:1737
 usb_probe_interface+0xece/0x1550 drivers/usb/core/driver.c:374
 really_probe+0xf20/0x20b0 drivers/base/dd.c:529
 driver_probe_device+0x293/0x390 drivers/base/dd.c:701
 __device_attach_driver+0x63f/0x830 drivers/base/dd.c:807
 bus_for_each_drv+0x2ca/0x3f0 drivers/base/bus.c:431
 __device_attach+0x4e2/0x7f0 drivers/base/dd.c:873
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:920
 bus_probe_device+0x177/0x3d0 drivers/base/bus.c:491
 device_add+0x3b0e/0x40d0 drivers/base/core.c:2680
 usb_set_configuration+0x380f/0x3f10 drivers/usb/core/message.c:2032
 usb_generic_driver_probe+0x138/0x300 drivers/usb/core/generic.c:241
 usb_probe_device+0x311/0x490 drivers/usb/core/driver.c:272
 really_probe+0xf20/0x20b0 drivers/base/dd.c:529
 driver_probe_device+0x293/0x390 drivers/base/dd.c:701
 __device_attach_driver+0x63f/0x830 drivers/base/dd.c:807
 bus_for_each_drv+0x2ca/0x3f0 drivers/base/bus.c:431
 __device_attach+0x4e2/0x7f0 drivers/base/dd.c:873
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:920
 bus_probe_device+0x177/0x3d0 drivers/base/bus.c:491
 device_add+0x3b0e/0x40d0 drivers/base/core.c:2680
 usb_new_device+0x1bd4/0x2a30 drivers/usb/core/hub.c:2554
 hub_port_connect drivers/usb/core/hub.c:5208 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5348 [inline]
 port_event drivers/usb/core/hub.c:5494 [inline]
 hub_event+0x5e7b/0x8a70 drivers/usb/core/hub.c:5576
 process_one_work+0x1688/0x2140 kernel/workqueue.c:2269
 worker_thread+0x10bc/0x2730 kernel/workqueue.c:2415
 kthread+0x551/0x590 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293

Local variable ----buf.i@asix_get_phy_addr created at:
 asix_read_cmd drivers/net/usb/asix_common.c:312 [inline]
 asix_read_phy_addr drivers/net/usb/asix_common.c:295 [inline]
 asix_get_phy_addr+0x4d/0x290 drivers/net/usb/asix_common.c:314
 asix_read_cmd drivers/net/usb/asix_common.c:312 [inline]
 asix_read_phy_addr drivers/net/usb/asix_common.c:295 [inline]
 asix_get_phy_addr+0x4d/0x290 drivers/net/usb/asix_common.c:314

Byte 10 of 16 is uninitialized
Memory access of size 16 starts at ffff8881053636b0
Data copied to user address 00007ffd7306ecd0
=====================================================

Crashes (22):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/25 19:05 https://github.com/google/kmsan.git master ce8056d1f79e 344da168 .config console log report syz C ci-upstream-kmsan-gce
2020/08/19 06:32 https://github.com/google/kmsan.git master ce8056d1f79e e1c29030 .config console log report syz C ci-upstream-kmsan-gce
2020/09/01 14:59 https://github.com/google/kmsan.git master 3b3ea6028136 d5a3ae1f .config console log report ci-upstream-kmsan-gce
2020/08/30 07:09 https://github.com/google/kmsan.git master 3b3ea6028136 d5a3ae1f .config console log report ci-upstream-kmsan-gce
2020/08/28 12:58 https://github.com/google/kmsan.git master ce8056d1f79e 816e0689 .config console log report ci-upstream-kmsan-gce
2020/08/26 23:29 https://github.com/google/kmsan.git master ce8056d1f79e 318430cb .config console log report ci-upstream-kmsan-gce
2020/08/26 04:34 https://github.com/google/kmsan.git master ce8056d1f79e 344da168 .config console log report ci-upstream-kmsan-gce
2020/08/25 04:12 https://github.com/google/kmsan.git master ce8056d1f79e 344da168 .config console log report ci-upstream-kmsan-gce
2020/08/24 16:25 https://github.com/google/kmsan.git master ce8056d1f79e 67b599d1 .config console log report ci-upstream-kmsan-gce
2020/08/24 03:02 https://github.com/google/kmsan.git master ce8056d1f79e cef5ae68 .config console log report ci-upstream-kmsan-gce
2020/08/19 05:24 https://github.com/google/kmsan.git master ce8056d1f79e e1c29030 .config console log report ci-upstream-kmsan-gce
2020/09/03 01:27 https://github.com/google/kmsan.git master 3b3ea6028136 abf9ba4f .config console log report ci-upstream-kmsan-gce-386
2020/08/30 08:00 https://github.com/google/kmsan.git master 3b3ea6028136 d5a3ae1f .config console log report ci-upstream-kmsan-gce-386
2020/08/29 05:31 https://github.com/google/kmsan.git master 3b3ea6028136 d5a3ae1f .config console log report ci-upstream-kmsan-gce-386
2020/08/28 13:02 https://github.com/google/kmsan.git master ce8056d1f79e 816e0689 .config console log report ci-upstream-kmsan-gce-386
2020/08/26 04:45 https://github.com/google/kmsan.git master ce8056d1f79e 344da168 .config console log report ci-upstream-kmsan-gce-386
2020/08/26 04:34 https://github.com/google/kmsan.git master ce8056d1f79e 344da168 .config console log report ci-upstream-kmsan-gce-386
2020/08/24 03:04 https://github.com/google/kmsan.git master ce8056d1f79e cef5ae68 .config console log report ci-upstream-kmsan-gce-386
2020/08/24 03:03 https://github.com/google/kmsan.git master ce8056d1f79e cef5ae68 .config console log report ci-upstream-kmsan-gce-386
2020/08/10 21:26 https://github.com/google/kmsan.git master ce8056d1f79e 7adc7b65 .config console log report ci-upstream-kmsan-gce-386
2020/08/10 14:35 https://github.com/google/kmsan.git master ce8056d1f79e 70301872 .config console log report ci-upstream-kmsan-gce-386
2020/08/09 10:51 https://github.com/google/kmsan.git master ce8056d1f79e f721e4a0 .config console log report ci-upstream-kmsan-gce-386
* Struck through repros no longer work on HEAD.