syzbot


KASAN: slab-use-after-free Read in load_firmware_cb

Status: moderation: reported on 2024/08/01 15:42
Subsystems: media
[Documentation on labels]
Reported-by: syzbot+c0d0bc2375f98b7d45e3@syzkaller.appspotmail.com
First crash: 136d, last: 78d
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 833d 1749d 0/28 auto-obsoleted due to no activity on 2023/11/09 13:12
linux-6.1 KASAN: use-after-free Read in load_firmware_cb 2 131d 132d 0/3 auto-obsoleted due to no activity on 2024/11/10 09:01

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in load_firmware_cb+0xbc/0x1638 drivers/media/tuners/xc2028.c:1372
Read of size 8 at addr ffff0000c8c70318 by task kworker/1:6/6465

CPU: 1 UID: 0 PID: 6465 Comm: kworker/1:6 Not tainted 6.11.0-rc7-syzkaller-g5f5673607153 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Workqueue: events request_firmware_work_func
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:319
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:326
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:119
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x198/0x538 mm/kasan/report.c:488
 kasan_report+0xd8/0x138 mm/kasan/report.c:601
 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
 load_firmware_cb+0xbc/0x1638 drivers/media/tuners/xc2028.c:1372
 request_firmware_work_func+0x150/0x214 drivers/base/firmware_loader/main.c:1167
 process_one_work+0x79c/0x15b8 kernel/workqueue.c:3231
 process_scheduled_works kernel/workqueue.c:3312 [inline]
 worker_thread+0x978/0xec4 kernel/workqueue.c:3389
 kthread+0x288/0x310 kernel/kthread.c:389
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860

Allocated by task 9256:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:565
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slub.c:4162 [inline]
 __kmalloc_node_track_caller_noprof+0x2d0/0x4d4 mm/slub.c:4181
 kmalloc_reserve+0x144/0x280 net/core/skbuff.c:605
 __alloc_skb+0x20c/0x420 net/core/skbuff.c:674
 alloc_skb include/linux/skbuff.h:1320 [inline]
 nlmsg_new include/net/netlink.h:1015 [inline]
 rtmsg_ifinfo_build_skb+0x94/0x25c net/core/rtnetlink.c:4070
 unregister_netdevice_many_notify+0xe34/0x1bc0 net/core/dev.c:11356
 unregister_netdevice_many net/core/dev.c:11414 [inline]
 default_device_exit_batch+0x9f0/0xa70 net/core/dev.c:11897
 ops_exit_list net/core/net_namespace.c:178 [inline]
 cleanup_net+0x6b8/0x9b4 net/core/net_namespace.c:640
 process_one_work+0x79c/0x15b8 kernel/workqueue.c:3231
 process_scheduled_works kernel/workqueue.c:3312 [inline]
 worker_thread+0x978/0xec4 kernel/workqueue.c:3389
 kthread+0x288/0x310 kernel/kthread.c:389
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860

Freed by task 9256:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:579
 poison_slab_object+0x128/0x180 mm/kasan/common.c:240
 __kasan_slab_free+0x3c/0x70 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2256 [inline]
 slab_free mm/slub.c:4477 [inline]
 kfree+0x154/0x3e0 mm/slub.c:4598
 skb_kfree_head net/core/skbuff.c:1084 [inline]
 skb_free_head+0xf4/0x1bc net/core/skbuff.c:1096
 skb_release_data+0x484/0x618 net/core/skbuff.c:1123
 skb_release_all net/core/skbuff.c:1188 [inline]
 __kfree_skb net/core/skbuff.c:1202 [inline]
 consume_skb+0xb8/0x194 net/core/skbuff.c:1426
 netlink_broadcast_filtered+0xf68/0x10ec net/netlink/af_netlink.c:1542
 nlmsg_multicast_filtered include/net/netlink.h:1125 [inline]
 nlmsg_multicast include/net/netlink.h:1144 [inline]
 nlmsg_notify+0xfc/0x1d8 net/netlink/af_netlink.c:2593
 rtnl_notify net/core/rtnetlink.c:757 [inline]
 rtmsg_ifinfo_send+0xb8/0xec net/core/rtnetlink.c:4100
 unregister_netdevice_many_notify+0x14e8/0x1bc0 net/core/dev.c:11379
 unregister_netdevice_many net/core/dev.c:11414 [inline]
 default_device_exit_batch+0x9f0/0xa70 net/core/dev.c:11897
 ops_exit_list net/core/net_namespace.c:178 [inline]
 cleanup_net+0x6b8/0x9b4 net/core/net_namespace.c:640
 process_one_work+0x79c/0x15b8 kernel/workqueue.c:3231
 process_scheduled_works kernel/workqueue.c:3312 [inline]
 worker_thread+0x978/0xec4 kernel/workqueue.c:3389
 kthread+0x288/0x310 kernel/kthread.c:389
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860

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

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x108c70
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x5ffc00000000040(head|node=0|zone=2|lastcpupid=0x7ff)
page_type: 0xfdffffff(slab)
raw: 05ffc00000000040 ffff0000c0002000 fffffdffc36ef400 dead000000000002
raw: 0000000000000000 0000000000080008 00000001fdffffff 0000000000000000
head: 05ffc00000000040 ffff0000c0002000 fffffdffc36ef400 dead000000000002
head: 0000000000000000 0000000000080008 00000001fdffffff 0000000000000000
head: 05ffc00000000003 fffffdffc3231c01 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000c8c70200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c8c70280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000c8c70300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff0000c8c70380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c8c70400: 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 = 0x0000000096000005
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x05: level 1 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
  CM = 0, WnR = 0, TnD = 0, TagAccess = 0
  GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[dfff800000000005] address between user and kernel address ranges
Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 UID: 0 PID: 6465 Comm: kworker/1:6 Tainted: G    B              6.11.0-rc7-syzkaller-g5f5673607153 #0
Tainted: [B]=BAD_PAGE
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Workqueue: events request_firmware_work_func
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : load_firmware_cb+0x1a8/0x1638 drivers/media/tuners/xc2028.c:1376
lr : load_firmware_cb+0xdc/0x1638 drivers/media/tuners/xc2028.c:1374
sp : ffff8000aee97880
x29: ffff8000aee979e0 x28: 0000000000000000 x27: ffff700015dd2f28
x26: 0000000000000000 x25: 1ffff00015dd2f4c x24: 1fffe0001918e063
x23: ffff8000aee97940 x22: dfff800000000000 x21: ffff0000d2b2d060
x20: dfff800000000000 x19: ffff0000c8c70318 x18: 0000000000000008
x17: 0000000000000000 x16: ffff800083032784 x15: 0000000000000001
x14: 1ffff00012543a94 x13: 0000000000000000 x12: 0000000000000000
x11: ffff700012543a95 x10: 0000000000ff0100 x9 : 0000000000000000
x8 : 0000000000000005 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff8000aee96ed8 x4 : ffff80008f65b620 x3 : ffff8000801dfd40
x2 : 0000000000000001 x1 : 0000000000000000 x0 : 0000000000000028
Call trace:
 load_firmware_cb+0x1a8/0x1638 drivers/media/tuners/xc2028.c:1376
 request_firmware_work_func+0x150/0x214 drivers/base/firmware_loader/main.c:1167
 process_one_work+0x79c/0x15b8 kernel/workqueue.c:3231
 process_scheduled_works kernel/workqueue.c:3312 [inline]
 worker_thread+0x978/0xec4 kernel/workqueue.c:3389
 kthread+0x288/0x310 kernel/kthread.c:389
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
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 (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/24 23:36 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5f5673607153 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in load_firmware_cb
2024/09/24 23:35 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5f5673607153 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in load_firmware_cb
2024/07/28 15:39 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c912bf709078 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in load_firmware_cb
2024/07/28 20:19 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c912bf709078 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: unable to handle kernel paging request in load_firmware_cb
* Struck through repros no longer work on HEAD.