Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBSAN: array-index-out-of-bounds in rtl8188eu/core/rtw_wlan_util.c when loading rtl8818eu wifi usb adaptor #460

Open
sardChen opened this issue Nov 4, 2024 · 0 comments

Comments

@sardChen
Copy link

sardChen commented Nov 4, 2024

When executing fuzzing test for loading rtl8818eu, I found four array-index-out-of-bounds bugs reported by UBSAN in dmesg logs:

[   72.895184] R8188EU: INFO indicate disassoc
[   73.073323] ================================================================================
[   73.073358] UBSAN: array-index-out-of-bounds in /home/sandy/workplace/wifiTool/driver/rtl8188eu/core/rtw_wlan_util.c:770:48
[   73.073376] index 1 is out of range for type 'u8 [1]'
[   73.073389] CPU: 6 PID: 0 Comm: swapper/6 Tainted: G           OE      6.6.58 #1
[   73.073402] Hardware name: Gigabyte Technology Co., Ltd. B660M GAMING AC DDR4/B660M GAMING AC DDR4, BIOS F4 01/17/2022
[   73.073410] Call Trace:
[   73.073415]  <IRQ>
[   73.073423]  dump_stack_lvl+0x48/0x70
[   73.073446]  dump_stack+0x10/0x20
[   73.073458]  __ubsan_handle_out_of_bounds+0xa2/0x100
[   73.073474]  HT_caps_handler+0x17e/0x5b0 [8188eu]
[   73.073700]  ? __pfx_HT_caps_handler+0x10/0x10 [8188eu]
[   73.073870]  OnAssocRsp+0x4f0/0x5a0 [8188eu]
[   73.074066]  _mgt_dispatcher+0x128/0x190 [8188eu]
[   73.074241]  ? __pfx__mgt_dispatcher+0x10/0x10 [8188eu]
[   73.074401]  ? _raw_spin_lock_bh+0x86/0xf0
[   73.074415]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.074430]  mgt_dispatcher+0x5d6/0x720 [8188eu]
[   73.074587]  ? rtw_get_stainfo+0x30c/0x370 [8188eu]
[   73.074790]  ? __pfx_mgt_dispatcher+0x10/0x10 [8188eu]
[   73.074966]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.074981]  rtw_recv_entry+0x1a4e/0x49f0 [8188eu]
[   73.075178]  ? __pfx_rtw_recv_entry+0x10/0x10 [8188eu]
[   73.075348]  ? update_recvframe_attrib_88e+0x7e0/0x860 [8188eu]
[   73.075525]  rtl8188eu_recv_tasklet+0x10f3/0x13e0 [8188eu]
[   73.075693]  tasklet_action_common.constprop.0+0x275/0x670
[   73.075713]  tasklet_action+0x22/0x30
[   73.075726]  handle_softirqs+0x192/0x5d0
[   73.075742]  __irq_exit_rcu+0x15c/0x1b0
[   73.075756]  irq_exit_rcu+0xe/0x20
[   73.075769]  common_interrupt+0xa4/0xb0
[   73.075780]  </IRQ>
[   73.075785]  <TASK>
[   73.075790]  asm_common_interrupt+0x27/0x40
[   73.075800] RIP: 0010:cpuidle_enter_state+0x1df/0x520
[   73.075813] Code: 01 73 dd 48 83 c4 28 44 89 f0 5b 41 5c 41 5d 41 5e 41 5f 5d 31 d2 31 c9 31 f6 31 ff 45 31 c0 c3 cc cc cc cc fb 0f 1f 44 00 00 <45> 85 f6 0f 89 06 ff ff ff 48 c7 43 18 00 00 00 00 49 83 fd 09 0f
[   73.075824] RSP: 0000:ffff888100da7d30 EFLAGS: 00000246
[   73.075838] RAX: 0000000000000000 RBX: ffff88885c34ffe0 RCX: 0000000000000000
[   73.075847] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[   73.075854] RBP: ffff888100da7d80 R08: 0000000000000000 R09: 0000000000000000
[   73.075861] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffb48627c0
[   73.075868] R13: 0000000000000004 R14: 0000000000000004 R15: 000000110380cbfa
[   73.075883]  cpuidle_enter+0x4f/0xb0
[   73.075898]  call_cpuidle+0x47/0xd0
[   73.075912]  do_idle+0x372/0x460
[   73.075927]  ? __pfx_do_idle+0x10/0x10
[   73.075941]  ? do_idle+0xd/0x460
[   73.075956]  cpu_startup_entry+0x58/0x70
[   73.075970]  start_secondary+0x220/0x2b0
[   73.075982]  ? __pfx_start_secondary+0x10/0x10
[   73.075995]  secondary_startup_64_no_verify+0x18f/0x19b
[   73.076014]  </TASK>
[   73.076025] ================================================================================
[   73.076036] ================================================================================
[   73.076044] UBSAN: array-index-out-of-bounds in /home/sandy/workplace/wifiTool/driver/rtl8188eu/core/rtw_wlan_util.c:773:75
[   73.076058] index 2 is out of range for type 'u8 [1]'
[   73.076068] CPU: 6 PID: 0 Comm: swapper/6 Tainted: G           OE      6.6.58 #1
[   73.076079] Hardware name: Gigabyte Technology Co., Ltd. B660M GAMING AC DDR4/B660M GAMING AC DDR4, BIOS F4 01/17/2022
[   73.076086] Call Trace:
[   73.076091]  <IRQ>
[   73.076096]  dump_stack_lvl+0x48/0x70
[   73.076110]  dump_stack+0x10/0x20
[   73.076122]  __ubsan_handle_out_of_bounds+0xa2/0x100
[   73.076135]  HT_caps_handler+0x295/0x5b0 [8188eu]
[   73.076328]  ? __pfx_HT_caps_handler+0x10/0x10 [8188eu]
[   73.076492]  OnAssocRsp+0x4f0/0x5a0 [8188eu]
[   73.076684]  _mgt_dispatcher+0x128/0x190 [8188eu]
[   73.076858]  ? __pfx__mgt_dispatcher+0x10/0x10 [8188eu]
[   73.077012]  ? _raw_spin_lock_bh+0x86/0xf0
[   73.077024]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.077039]  mgt_dispatcher+0x5d6/0x720 [8188eu]
[   73.077194]  ? rtw_get_stainfo+0x30c/0x370 [8188eu]
[   73.077379]  ? __pfx_mgt_dispatcher+0x10/0x10 [8188eu]
[   73.077549]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.077564]  rtw_recv_entry+0x1a4e/0x49f0 [8188eu]
[   73.077755]  ? __pfx_rtw_recv_entry+0x10/0x10 [8188eu]
[   73.077926]  ? update_recvframe_attrib_88e+0x7e0/0x860 [8188eu]
[   73.078099]  rtl8188eu_recv_tasklet+0x10f3/0x13e0 [8188eu]
[   73.078267]  tasklet_action_common.constprop.0+0x275/0x670
[   73.078285]  tasklet_action+0x22/0x30
[   73.078298]  handle_softirqs+0x192/0x5d0
[   73.078314]  __irq_exit_rcu+0x15c/0x1b0
[   73.078327]  irq_exit_rcu+0xe/0x20
[   73.078340]  common_interrupt+0xa4/0xb0
[   73.078349]  </IRQ>
[   73.078354]  <TASK>
[   73.078360]  asm_common_interrupt+0x27/0x40
[   73.078363] RIP: 0010:cpuidle_enter_state+0x1df/0x520
[   73.078365] Code: 01 73 dd 48 83 c4 28 44 89 f0 5b 41 5c 41 5d 41 5e 41 5f 5d 31 d2 31 c9 31 f6 31 ff 45 31 c0 c3 cc cc cc cc fb 0f 1f 44 00 00 <45> 85 f6 0f 89 06 ff ff ff 48 c7 43 18 00 00 00 00 49 83 fd 09 0f
[   73.078367] RSP: 0000:ffff888100da7d30 EFLAGS: 00000246
[   73.078369] RAX: 0000000000000000 RBX: ffff88885c34ffe0 RCX: 0000000000000000
[   73.078370] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[   73.078372] RBP: ffff888100da7d80 R08: 0000000000000000 R09: 0000000000000000
[   73.078373] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffb48627c0
[   73.078374] R13: 0000000000000004 R14: 0000000000000004 R15: 000000110380cbfa
[   73.078377]  cpuidle_enter+0x4f/0xb0
[   73.078379]  call_cpuidle+0x47/0xd0
[   73.078382]  do_idle+0x372/0x460
[   73.078385]  ? __pfx_do_idle+0x10/0x10
[   73.078387]  ? do_idle+0xd/0x460
[   73.078390]  cpu_startup_entry+0x58/0x70
[   73.078393]  start_secondary+0x220/0x2b0
[   73.078395]  ? __pfx_start_secondary+0x10/0x10
[   73.078397]  secondary_startup_64_no_verify+0x18f/0x19b
[   73.078400]  </TASK>
[   73.078402] ================================================================================
[   73.078404] ================================================================================
[   73.078406] UBSAN: array-index-out-of-bounds in /home/sandy/workplace/wifiTool/driver/rtl8188eu/core/rtw_wlan_util.c:778:76
[   73.078408] index 2 is out of range for type 'u8 [1]'
[   73.078410] CPU: 6 PID: 0 Comm: swapper/6 Tainted: G           OE      6.6.58 #1
[   73.078412] Hardware name: Gigabyte Technology Co., Ltd. B660M GAMING AC DDR4/B660M GAMING AC DDR4, BIOS F4 01/17/2022
[   73.078413] Call Trace:
[   73.078414]  <IRQ>
[   73.078415]  dump_stack_lvl+0x48/0x70
[   73.078418]  dump_stack+0x10/0x20
[   73.078420]  __ubsan_handle_out_of_bounds+0xa2/0x100
[   73.078422]  HT_caps_handler+0x306/0x5b0 [8188eu]
[   73.078461]  ? __pfx_HT_caps_handler+0x10/0x10 [8188eu]
[   73.078495]  OnAssocRsp+0x4f0/0x5a0 [8188eu]
[   73.078531]  _mgt_dispatcher+0x128/0x190 [8188eu]
[   73.078563]  ? __pfx__mgt_dispatcher+0x10/0x10 [8188eu]
[   73.078593]  ? _raw_spin_lock_bh+0x86/0xf0
[   73.078595]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.078598]  mgt_dispatcher+0x5d6/0x720 [8188eu]
[   73.078627]  ? rtw_get_stainfo+0x30c/0x370 [8188eu]
[   73.078664]  ? __pfx_mgt_dispatcher+0x10/0x10 [8188eu]
[   73.078695]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.078698]  rtw_recv_entry+0x1a4e/0x49f0 [8188eu]
[   73.078735]  ? __pfx_rtw_recv_entry+0x10/0x10 [8188eu]
[   73.078766]  ? update_recvframe_attrib_88e+0x7e0/0x860 [8188eu]
[   73.078799]  rtl8188eu_recv_tasklet+0x10f3/0x13e0 [8188eu]
[   73.078831]  tasklet_action_common.constprop.0+0x275/0x670
[   73.078835]  tasklet_action+0x22/0x30
[   73.078837]  handle_softirqs+0x192/0x5d0
[   73.078840]  __irq_exit_rcu+0x15c/0x1b0
[   73.078843]  irq_exit_rcu+0xe/0x20
[   73.078845]  common_interrupt+0xa4/0xb0
[   73.078847]  </IRQ>
[   73.078848]  <TASK>
[   73.078849]  asm_common_interrupt+0x27/0x40
[   73.078851] RIP: 0010:cpuidle_enter_state+0x1df/0x520
[   73.078852] Code: 01 73 dd 48 83 c4 28 44 89 f0 5b 41 5c 41 5d 41 5e 41 5f 5d 31 d2 31 c9 31 f6 31 ff 45 31 c0 c3 cc cc cc cc fb 0f 1f 44 00 00 <45> 85 f6 0f 89 06 ff ff ff 48 c7 43 18 00 00 00 00 49 83 fd 09 0f
[   73.078854] RSP: 0000:ffff888100da7d30 EFLAGS: 00000246
[   73.078856] RAX: 0000000000000000 RBX: ffff88885c34ffe0 RCX: 0000000000000000
[   73.078857] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[   73.078858] RBP: ffff888100da7d80 R08: 0000000000000000 R09: 0000000000000000
[   73.078860] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffb48627c0
[   73.078861] R13: 0000000000000004 R14: 0000000000000004 R15: 000000110380cbfa
[   73.078864]  cpuidle_enter+0x4f/0xb0
[   73.078866]  call_cpuidle+0x47/0xd0
[   73.078868]  do_idle+0x372/0x460
[   73.078871]  ? __pfx_do_idle+0x10/0x10
[   73.078874]  ? do_idle+0xd/0x460
[   73.078877]  cpu_startup_entry+0x58/0x70
[   73.078879]  start_secondary+0x220/0x2b0
[   73.078881]  ? __pfx_start_secondary+0x10/0x10
[   73.078884]  secondary_startup_64_no_verify+0x18f/0x19b
[   73.078887]  </TASK>
[   73.078888] ================================================================================
[   73.078890] ================================================================================
[   73.078892] UBSAN: array-index-out-of-bounds in /home/sandy/workplace/wifiTool/driver/rtl8188eu/core/rtw_wlan_util.c:781:34
[   73.078894] index 2 is out of range for type 'u8 [1]'
[   73.078896] CPU: 6 PID: 0 Comm: swapper/6 Tainted: G           OE      6.6.58 #1
[   73.078898] Hardware name: Gigabyte Technology Co., Ltd. B660M GAMING AC DDR4/B660M GAMING AC DDR4, BIOS F4 01/17/2022
[   73.078899] Call Trace:
[   73.078900]  <IRQ>
[   73.078901]  dump_stack_lvl+0x48/0x70
[   73.078903]  dump_stack+0x10/0x20
[   73.078906]  __ubsan_handle_out_of_bounds+0xa2/0x100
[   73.078908]  HT_caps_handler+0x32c/0x5b0 [8188eu]
[   73.078944]  ? __pfx_HT_caps_handler+0x10/0x10 [8188eu]
[   73.078976]  OnAssocRsp+0x4f0/0x5a0 [8188eu]
[   73.079012]  _mgt_dispatcher+0x128/0x190 [8188eu]
[   73.079044]  ? __pfx__mgt_dispatcher+0x10/0x10 [8188eu]
[   73.079074]  ? _raw_spin_lock_bh+0x86/0xf0
[   73.079077]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.079080]  mgt_dispatcher+0x5d6/0x720 [8188eu]
[   73.079109]  ? rtw_get_stainfo+0x30c/0x370 [8188eu]
[   73.079147]  ? __pfx_mgt_dispatcher+0x10/0x10 [8188eu]
[   73.079178]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[   73.079181]  rtw_recv_entry+0x1a4e/0x49f0 [8188eu]
[   73.079218]  ? __pfx_rtw_recv_entry+0x10/0x10 [8188eu]
[   73.079251]  ? update_recvframe_attrib_88e+0x7e0/0x860 [8188eu]
[   73.079284]  rtl8188eu_recv_tasklet+0x10f3/0x13e0 [8188eu]
[   73.079316]  tasklet_action_common.constprop.0+0x275/0x670
[   73.079319]  tasklet_action+0x22/0x30
[   73.079322]  handle_softirqs+0x192/0x5d0
[   73.079325]  __irq_exit_rcu+0x15c/0x1b0
[   73.079327]  irq_exit_rcu+0xe/0x20
[   73.079330]  common_interrupt+0xa4/0xb0
[   73.079332]  </IRQ>
[   73.079332]  <TASK>
[   73.079334]  asm_common_interrupt+0x27/0x40
[   73.079335] RIP: 0010:cpuidle_enter_state+0x1df/0x520
[   73.079337] Code: 01 73 dd 48 83 c4 28 44 89 f0 5b 41 5c 41 5d 41 5e 41 5f 5d 31 d2 31 c9 31 f6 31 ff 45 31 c0 c3 cc cc cc cc fb 0f 1f 44 00 00 <45> 85 f6 0f 89 06 ff ff ff 48 c7 43 18 00 00 00 00 49 83 fd 09 0f
[   73.079339] RSP: 0000:ffff888100da7d30 EFLAGS: 00000246
[   73.079340] RAX: 0000000000000000 RBX: ffff88885c34ffe0 RCX: 0000000000000000
[   73.079342] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[   73.079343] RBP: ffff888100da7d80 R08: 0000000000000000 R09: 0000000000000000
[   73.079344] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffb48627c0
[   73.079345] R13: 0000000000000004 R14: 0000000000000004 R15: 000000110380cbfa
[   73.079348]  cpuidle_enter+0x4f/0xb0
[   73.079350]  call_cpuidle+0x47/0xd0
[   73.079353]  do_idle+0x372/0x460
[   73.079356]  ? __pfx_do_idle+0x10/0x10
[   73.079358]  ? do_idle+0xd/0x460
[   73.079361]  cpu_startup_entry+0x58/0x70
[   73.079364]  start_secondary+0x220/0x2b0
[   73.079366]  ? __pfx_start_secondary+0x10/0x10
[   73.079368]  secondary_startup_64_no_verify+0x18f/0x19b
[   73.079371]  </TASK>
[   73.079373] ================================================================================


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant