syzbot


KASAN: use-after-free Read in load_firmware_cb

Status: auto-obsoleted due to no activity on 2024/11/10 09:01
Reported-by: syzbot+8cc10583c147e90cb5be@syzkaller.appspotmail.com
First crash: 142d, last: 141d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in load_firmware_cb usb media C 12 843d 1759d 0/28 auto-obsoleted due to no activity on 2023/11/09 13:12
upstream KASAN: slab-use-after-free Read in load_firmware_cb media 4 87d 141d 0/28 moderation: reported on 2024/08/01 15:42

Sample crash report:
kobject_add_internal failed for firmware (error: -2 parent: 1-1:0.0)
firmware xc3028-v27.fw: fw_load_sysfs_fallback: device_register failed
==================================================================
BUG: KASAN: use-after-free in load_firmware_cb+0x9c/0x1618 drivers/media/tuners/xc2028.c:1364
Read of size 8 at addr ffff0000dce61318 by task kworker/1:2/112

CPU: 1 PID: 112 Comm: kworker/1:2 Not tainted 6.1.102-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: events request_firmware_work_func
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report+0xd4/0x130 mm/kasan/report.c:495
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 load_firmware_cb+0x9c/0x1618 drivers/media/tuners/xc2028.c:1364
 request_firmware_work_func+0x150/0x214 drivers/base/firmware_loader/main.c:1107
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Allocated by task 112:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x7c/0x94 mm/slab_common.c:1050
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:692 [inline]
 tuner_probe+0x108/0x1788 drivers/media/v4l2-core/tuner-core.c:638
 i2c_device_probe+0x6a8/0x94c drivers/i2c/i2c-core-base.c:568
 really_probe+0x394/0xacc drivers/base/dd.c:639
 __driver_probe_device+0x194/0x3b4 drivers/base/dd.c:785
 driver_probe_device+0x78/0x330 drivers/base/dd.c:815
 __device_attach_driver+0x2a8/0x4f4 drivers/base/dd.c:943
 bus_for_each_drv+0x158/0x1e0 drivers/base/bus.c:427
 __device_attach+0x2f0/0x480 drivers/base/dd.c:1015
 device_initial_probe+0x24/0x34 drivers/base/dd.c:1064
 bus_probe_device+0xbc/0x1c8 drivers/base/bus.c:487
 device_add+0xae0/0xef4 drivers/base/core.c:3689
 device_register+0x28/0x38 drivers/base/core.c:3771
 i2c_new_client_device+0x7d4/0xc00 drivers/i2c/i2c-core-base.c:971
 v4l2_i2c_new_subdev_board+0xb0/0x20c drivers/media/v4l2-core/v4l2-i2c.c:80
 v4l2_i2c_new_subdev+0xe4/0x150 drivers/media/v4l2-core/v4l2-i2c.c:135
 em28xx_v4l2_init+0x6c8/0x28d4 drivers/media/usb/em28xx/em28xx-video.c:2617
 em28xx_init_extension+0x10c/0x1b4 drivers/media/usb/em28xx/em28xx-core.c:1116
 request_module_async+0x68/0x98 drivers/media/usb/em28xx/em28xx-cards.c:3405
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 process_scheduled_works kernel/workqueue.c:2355 [inline]
 worker_thread+0xb20/0xfec kernel/workqueue.c:2444
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Freed by task 112:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:1007
 tuner_remove+0x1d8/0x1f4 drivers/media/v4l2-core/tuner-core.c:791
 i2c_device_remove+0x8c/0x1c0 drivers/i2c/i2c-core-base.c:609
 device_remove drivers/base/dd.c:548 [inline]
 __device_release_driver drivers/base/dd.c:1260 [inline]
 device_release_driver_internal+0x42c/0x724 drivers/base/dd.c:1286
 device_release_driver+0x28/0x38 drivers/base/dd.c:1309
 bus_remove_device+0x298/0x38c drivers/base/bus.c:529
 device_del+0x57c/0x9bc drivers/base/core.c:3877
 device_unregister+0x2c/0xcc drivers/base/core.c:3920
 i2c_unregister_device+0x118/0x170 drivers/i2c/i2c-core-base.c:1016
 v4l2_i2c_subdev_unregister+0xa8/0xbc drivers/media/v4l2-core/v4l2-i2c.c:28
 v4l2_device_unregister+0x17c/0x248 drivers/media/v4l2-core/v4l2-device.c:102
 em28xx_v4l2_init+0x1300/0x28d4 drivers/media/usb/em28xx/em28xx-video.c:2898
 em28xx_init_extension+0x10c/0x1b4 drivers/media/usb/em28xx/em28xx-core.c:1116
 request_module_async+0x68/0x98 drivers/media/usb/em28xx/em28xx-cards.c:3405
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 process_scheduled_works kernel/workqueue.c:2355 [inline]
 worker_thread+0xb20/0xfec kernel/workqueue.c:2444
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

The buggy address belongs to the object at ffff0000dce61000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 792 bytes inside of
 2048-byte region [ffff0000dce61000, ffff0000dce61800)

The buggy address belongs to the physical page:
page:0000000063d31243 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11ce60
head:0000000063d31243 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc0003129a00 dead000000000002 ffff0000c0002900
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000dce61200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dce61280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000dce61300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff0000dce61380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dce61400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Unable to handle kernel paging request at virtual address dfff800000000005
KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
Mem abort info:
  ESR = 0x0000000096000006
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x06: level 2 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000006
  CM = 0, WnR = 0
[dfff800000000005] address between user and kernel address ranges
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 112 Comm: kworker/1:2 Tainted: G    B              6.1.102-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: events request_firmware_work_func
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : load_firmware_cb+0x188/0x1618 drivers/media/tuners/xc2028.c:1369
lr : load_firmware_cb+0xbc/0x1618 drivers/media/tuners/xc2028.c:1367
sp : ffff80001dbd78c0
x29: ffff80001dbd7a20 x28: 0000000000000000 x27: ffff700003b7af30
x26: 0000000000000000 x25: 1ffff00003b7af54 x24: 1fffe0001b9cc263
x23: ffff80001dbd7980 x22: dfff800000000000 x21: ffff0000ef17a560
x20: dfff800000000000 x19: ffff0000dce61318 x18: 1fffe00036868776
x17: ffff8000159bd000 x16: ffff8000122835b4 x15: ffff0001b4343bbc
x14: ffff0001b4343bb8 x13: 1fffe00036868776 x12: 0000000000000001
x11: 0000000000ff0100 x10: 0000000000000000 x9 : ffff80000e5ea464
x8 : 0000000000000005 x7 : 1fffe00036868777 x6 : ffff80000827cf40
x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff8000081ae3ac
x2 : 0000000000000001 x1 : 0000000000000000 x0 : 0000000000000028
Call trace:
 load_firmware_cb+0x188/0x1618 drivers/media/tuners/xc2028.c:1369
 request_firmware_work_func+0x150/0x214 drivers/base/firmware_loader/main.c:1107
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864
Code: 9100a380 d2d00016 d343fc08 f2fbfff6 (38746908) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	9100a380 	add	x0, x28, #0x28
   4:	d2d00016 	mov	x22, #0x800000000000        	// #140737488355328
   8:	d343fc08 	lsr	x8, x0, #3
   c:	f2fbfff6 	movk	x22, #0xdfff, lsl #48
* 10:	38746908 	ldrb	w8, [x8, x20] <-- trapping instruction

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/02 09:01 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in load_firmware_cb
2024/08/01 11:49 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in load_firmware_cb
* Struck through repros no longer work on HEAD.