[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c2296090-2e9b-fafb-35da-e01b025b53b7@gmail.com>
Date: Sun, 24 Apr 2022 18:06:32 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Solomon Tan <wjsota@...il.com>,
Michael Straube <straube.linux@...il.com>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
"open list:STAGING SUBSYSTEM" <linux-staging@...ts.linux.dev>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [BUG] staging: r8188eu: KASAN: slab-out-of-bounds in
rtw_cmd_thread
Hi Solomon,
On 4/24/22 15:11, Solomon Tan wrote:
> On Sun, Apr 24, 2022 at 12:00:12PM +0200, Michael Straube wrote:
>> Hi,
>>
>> It looks like
>> commit 0afaa121813e ("staging: r8188eu: use in-kernel ieee channel")
>> intoduced a. See KASAN output below.
>>
>> That commit replaced the use of struct rtw_ieee80211_channel with struct
>> ieee80211_channel.
>>
>> There are several calls to memcpy that used sizeof(struct
>> rtw_ieee80211_channel)
>> and now use sizeof(struct ieee80211_channel) but the sizes of these two
>> structures are not equal.
>>
>
> Oh no. When does this issue get triggered?
>
>> regards,
>> Michael
>>
>> dmesg:
>>
>> ==================================================================
>> [ 422.214237] BUG: KASAN: slab-out-of-bounds in rtw_cmd_thread+0x1e8/0x430
>> [r8188eu]
>> [ 422.214277] Write of size 3600 at addr ffff8881e149d200 by task
>> RTW_CMD_THREAD/2563
>>
>> [ 422.214289] CPU: 11 PID: 2563 Comm: RTW_CMD_THREAD Tainted: G C OE
>> 5.18.0-rc2-staging+ #47 94e3ca73bebf5b7fec506721475e4fff2a023bb9
>> [ 422.214301] Hardware name: Gigabyte Technology Co., Ltd. B550M S2H/B550M
>> S2H, BIOS F15a 02/16/2022
>> [ 422.214309] Call Trace:
>> [ 422.214313] <TASK>
>> [ 422.214317] dump_stack_lvl+0x45/0x5b
>> [ 422.214327] print_report.cold+0x5e/0x5dc
>> [ 422.214335] ? kasan_set_track+0x21/0x30
>> [ 422.214342] ? kasan_set_free_info+0x20/0x40
>> [ 422.214349] ? rtw_cmd_thread+0x1e8/0x430 [r8188eu
>> 91924fe1575bf49b9b37985ffde2c585d847446d]
>> [ 422.214386] kasan_report+0xab/0x120
>> [ 422.214394] ? rtw_cmd_thread+0x1e8/0x430 [r8188eu
>> 91924fe1575bf49b9b37985ffde2c585d847446d]
>> [ 422.214430] kasan_check_range+0xf6/0x1d0
>> [ 422.214436] memcpy+0x39/0x60
>> [ 422.214442] rtw_cmd_thread+0x1e8/0x430 [r8188eu
>> 91924fe1575bf49b9b37985ffde2c585d847446d]
>> [ 422.214479] ? rtw_setassocsta_cmdrsp_callback+0xd0/0xd0 [r8188eu
>> 91924fe1575bf49b9b37985ffde2c585d847446d]
>> [ 422.214516] kthread+0x15d/0x190
>> [ 422.214523] ? kthread_complete_and_exit+0x20/0x20
>> [ 422.214531] ret_from_fork+0x22/0x30
>> [ 422.214540] </TASK>
>
> Sorry, I am not familiar with KASAN. How should I interpret this output?
> I see the paragraph above has references to rtw_cmd_thread. I assume
> that is its way of indicating that rtw_cmd_thread is the cause of the
> problem, but the one below refers to other functions. I'm not sure where
> I should start looking. I would start looking at `rtw_sitesurvey_cmd` and
> `rtw_scan_ch_decision`, which call the memcpy on the
> rtw_ieee80211_channel structure, but they are not on the call trace.
>
drivers/staging/r8188eu/core/rtw_cmd.c:276: memcpy() call.
As Michael said the sizes of structures do not mach and the memcpy
writes below allocated buffer.
With regards,
Pavel Skripkin
Powered by blists - more mailing lists