netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	'Linux Kernel' <linux-kernel@vger.kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	Kurt Cancemi <kurt@x64architecture.com>,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: UBSAN: invalid-load in net/mac80211/status.c:1164:21
Date: Wed, 30 Mar 2022 15:46:20 +0200	[thread overview]
Message-ID: <87bkxn4kpf.fsf@toke.dk> (raw)
In-Reply-To: <892635fbacdc171baba2cba1b501f30b6a4faeca.camel@sipsolutions.net>

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;
 


      reply	other threads:[~2022-03-30 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 11:49 UBSAN: invalid-load in net/mac80211/status.c:1164:21 Bagas Sanjaya
2022-03-30 13:23 ` Johannes Berg
2022-03-30 13:46   ` Toke Høiland-Jørgensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkxn4kpf.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=andrew@lunn.ch \
    --cc=bagasdotme@gmail.com \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=kurt@x64architecture.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).