lkml.org 
[lkml]   [2022]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: UBSAN: invalid-load in net/mac80211/status.c:1164:21
Date
Johannes Berg <johannes@sipsolutions.net> writes:

> On Wed, 2022-03-30 at 18:49 +0700, Bagas Sanjaya wrote:
>>
>> [ 1152.928312] UBSAN: invalid-load in net/mac80211/status.c:1164:21
>> [ 1152.928318] load of value 255 is not a valid value for type '_Bool'
>
>
> That's loading status->is_valid_ack_signal, it seems.
>
> Note how that's in a union, shadowed by the 0x00ff0000'00000000 byte of
> the control.vif pointer (if I'm counting bytes correctly). That's kind
> of expected to be 0xff.
>
>> [ 1152.928323] CPU: 1 PID: 857 Comm: rs:main Q:Reg Not tainted 5.17.1-kernelorg-stable-generic #1
>> [ 1152.928329] Hardware name: Acer Aspire E5-571/EA50_HB , BIOS V1.04 05/06/2014
>> [ 1152.928331] Call Trace:
>> [ 1152.928334] <TASK>
>> [ 1152.928338] dump_stack_lvl+0x4c/0x63
>> [ 1152.928350] dump_stack+0x10/0x12
>> [ 1152.928354] ubsan_epilogue+0x9/0x45
>> [ 1152.928359] __ubsan_handle_load_invalid_value.cold+0x44/0x49
>> [ 1152.928365] ieee80211_tx_status_ext.cold+0xa3/0xb8 [mac80211]
>> [ 1152.928467] ieee80211_tx_status+0x7d/0xa0 [mac80211]
>> [ 1152.928535] ath_txq_unlock_complete+0x15c/0x170 [ath9k]
>> [ 1152.928553] ath_tx_edma_tasklet+0xe5/0x4c0 [ath9k]
>> [ 1152.928567] ath9k_tasklet+0x14e/0x280 [ath9k]
>
> Which sort of means that ath9k isn't setting up the status area
> correctly?

Yeah, it seems to be only setting fields individually, so AFAICT it's
skipping 'antenna' and 'flags' in info->status.

>> The bisection process, starting from v5.17 (the first tag with the warning),
>> found first 'oops' commit at 837d9e49402eaf (net: phy: marvell: Fix invalid
>> comparison in the resume and suspend functions, 2022-03-12). However, since
>> the commit didn't touch net/mac80211/status.c, it wasn't the root cause
>> commit.
>
> Well you'd look for something in ath9k, I guess. But you didn't limit
> the bisect, so not sure why it went off into the weeds. Maybe you got
> one of them wrong.
>
>> The latest commit that touch the file in question is commit
>> ea5907db2a9ccf (mac80211: fix struct ieee80211_tx_info size, 2022-02-02).
>
> That's after 5.17 though, and it replaced the bool by just a flag.
>
>
> Seems to me ath9k should use something like
> ieee80211_tx_info_clear_status() or do the memset by itself? This bug
> would now not be reported, but it might report the flag erroneously.

So something like the below, maybe?

-Toke

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index d0caf1de2bde..425fe0df7d62 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2553,6 +2553,8 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
struct ath_hw *ah = sc->sc_ah;
u8 i, tx_rateindex;

+ ieee80211_tx_info_clear_status(tx_info);
+
if (txok)
tx_info->status.ack_signal = ts->ts_rssi;

\
 
 \ /
  Last update: 2022-03-30 15:47    [W:0.229 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site