syzbot


KASAN: use-after-free Read in appledisplay_bl_get_brightness

Status: fixed on 2019/12/13 00:31
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+495dab1f175edc9c2f13@syzkaller.appspotmail.com
Fix commit: 91feb01596e5 appledisplay: fix error handling in the scheduled work
First crash: 1707d, last: 1707d
Duplicate bugs (1)
duplicates (1):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
WARNING: ODEBUG bug in appledisplay_probe usb C 13 1694d 1724d 0/26 closed as dup on 2020/03/09 15:21
Discussions (10)
Title Replies (including bot) Last reply
[PATCH 3.16 000/148] 3.16.82-rc1 review 151 (151) 2020/02/09 18:51
[PATCH 4.19 000/306] 4.19.87-stable review 359 (359) 2020/01/28 13:29
[PATCH 4.4 000/132] 4.4.204-stable review 142 (142) 2019/12/03 18:58
[PATCH 4.14 000/211] 4.14.157-stable review 220 (220) 2019/11/29 18:48
[PATCH 5.4 00/66] 5.4.1-stable review 75 (75) 2019/11/29 08:52
[PATCH 4.9 000/151] 4.9.204-stable review 156 (156) 2019/11/29 00:03
[PATCH 5.3 00/95] 5.3.14-stable review 100 (100) 2019/11/28 21:29
[PATCH] usb: appledisplay: fix use-after-free in bl_get_brightness 6 (7) 2019/11/07 08:50
[PATCH] appledisplay: fix error handling in the scheduled work 2 (2) 2019/11/06 12:49
KASAN: use-after-free Read in appledisplay_bl_get_brightness 1 (2) 2019/09/23 14:53
Last patch testing requests (2)
Created Duration User Patch Repo Result
2019/11/06 11:59 17m oneukum@suse.com patch https://github.com/google/kasan.git e0bd8d79 OK
2019/11/05 22:53 18m tranmanphong@gmail.com patch https://github.com/google/kasan.git b1aa9d834830856eb437fbe000b9e22f7701c492 OK

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in appledisplay_bl_get_brightness+0x1ac/0x1c0 drivers/usb/misc/appledisplay.c:167
Read of size 8 at addr ffff8881cfc576a0 by task kworker/1:0/17

CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.3.0+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events appledisplay_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0xca/0x13e lib/dump_stack.c:113
 print_address_description+0x6a/0x32c mm/kasan/report.c:351
 __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:482
 kasan_report+0xe/0x12 mm/kasan/common.c:618
 appledisplay_bl_get_brightness+0x1ac/0x1c0 drivers/usb/misc/appledisplay.c:167
 appledisplay_work+0x36/0x160 drivers/usb/misc/appledisplay.c:187
 process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
 worker_thread+0x96/0xe20 kernel/workqueue.c:2415
 kthread+0x318/0x420 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 83:
 save_stack+0x1b/0x80 mm/kasan/common.c:69
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc mm/kasan/common.c:493 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:466
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:748 [inline]
 appledisplay_probe+0x15a/0xb37 drivers/usb/misc/appledisplay.c:218
 usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
 really_probe+0x281/0x6d0 drivers/base/dd.c:548
 driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
 bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:430
 __device_attach+0x217/0x360 drivers/base/dd.c:894
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:490
 device_add+0xae6/0x16f0 drivers/base/core.c:2201
 usb_set_configuration+0xdf6/0x1670 drivers/usb/core/message.c:2023
 generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210
 usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266
 really_probe+0x281/0x6d0 drivers/base/dd.c:548
 driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
 bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:430
 __device_attach+0x217/0x360 drivers/base/dd.c:894
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:490
 device_add+0xae6/0x16f0 drivers/base/core.c:2201
 usb_new_device.cold+0x6a4/0xe79 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+0x1b5c/0x3640 drivers/usb/core/hub.c:5441
 process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
 worker_thread+0x96/0xe20 kernel/workqueue.c:2415
 kthread+0x318/0x420 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Freed by task 83:
 save_stack+0x1b/0x80 mm/kasan/common.c:69
 set_track mm/kasan/common.c:77 [inline]
 __kasan_slab_free+0x130/0x180 mm/kasan/common.c:455
 slab_free_hook mm/slub.c:1423 [inline]
 slab_free_freelist_hook mm/slub.c:1474 [inline]
 slab_free mm/slub.c:3016 [inline]
 kfree+0xe4/0x2f0 mm/slub.c:3957
 appledisplay_probe+0x772/0xb37 drivers/usb/misc/appledisplay.c:312
 usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
 really_probe+0x281/0x6d0 drivers/base/dd.c:548
 driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
 bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:430
 __device_attach+0x217/0x360 drivers/base/dd.c:894
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:490
 device_add+0xae6/0x16f0 drivers/base/core.c:2201
 usb_set_configuration+0xdf6/0x1670 drivers/usb/core/message.c:2023
 generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210
 usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266
 really_probe+0x281/0x6d0 drivers/base/dd.c:548
 driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
 bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:430
 __device_attach+0x217/0x360 drivers/base/dd.c:894
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:490
 device_add+0xae6/0x16f0 drivers/base/core.c:2201
 usb_new_device.cold+0x6a4/0xe79 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+0x1b5c/0x3640 drivers/usb/core/hub.c:5441
 process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
 worker_thread+0x96/0xe20 kernel/workqueue.c:2415
 kthread+0x318/0x420 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff8881cfc57680
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 32 bytes inside of
 512-byte region [ffff8881cfc57680, ffff8881cfc57880)
The buggy address belongs to the page:
page:ffffea00073f1580 refcount:1 mapcount:0 mapping:ffff8881da002500 index:0x0 compound_mapcount: 0
flags: 0x200000000010200(slab|head)
raw: 0200000000010200 dead000000000100 dead000000000122 ffff8881da002500
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881cfc57580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881cfc57600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881cfc57680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8881cfc57700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881cfc57780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/09/21 04:21 https://github.com/google/kasan.git usb-fuzzer e0bd8d794fc9 d96e88f3 .config console log report syz C ci2-upstream-usb
* Struck through repros no longer work on HEAD.