netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* UBSAN: invalid-load in net/mac80211/status.c:1164:21
@ 2022-03-30 11:49 Bagas Sanjaya
  2022-03-30 13:23 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Bagas Sanjaya @ 2022-03-30 11:49 UTC (permalink / raw)
  To: 'Linux Kernel'
  Cc: Johannes Berg, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, Kurt Cancemi, Andrew Lunn

[-- Attachment #1: Type: text/plain, Size: 5022 bytes --]

Hello,

Running 5.17.1 kernel, I got UBSAN warning:

[ 1152.915532] wlp2s0: authenticate with 3e:b6:b7:41:a8:89
[ 1152.915563] wlp2s0: bad VHT capabilities, disabling VHT
[ 1152.915567] wlp2s0: 80 MHz not supported, disabling VHT
[ 1152.927460] wlp2s0: send auth to 3e:b6:b7:41:a8:89 (try 1/3)
[ 1152.928305] ================================================================================
[ 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'
[ 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]
[ 1152.928575]  tasklet_action_common.isra.0+0xc0/0xf0
[ 1152.928582]  tasklet_action+0x22/0x30
[ 1152.928586]  __do_softirq+0xdd/0x31c
[ 1152.928589]  ? ioapic_ir_ack_level+0x22/0x30
[ 1152.928594]  irq_exit_rcu+0x79/0xa0
[ 1152.928598]  common_interrupt+0x4a/0xa0
[ 1152.928602]  ? asm_common_interrupt+0x8/0x40
[ 1152.928606]  asm_common_interrupt+0x1e/0x40
[ 1152.928611] RIP: 0033:0x7f44a00557dd
[ 1152.928614] Code: fa 8b 47 10 89 c2 81 e2 7f 01 00 00 83 e0 7c 75 2c 41 89 c0 85 d2 75 35 83 6f 0c 01 31 c0 c7 47 08 00 00 00 00 8b 77 10 87 07 <83> f8 01 7f 3e 90 44 89 c0 c3 66 0f 1f 84 00 00 00 00 00 be 01 00
[ 1152.928617] RSP: 002b:00007f449eebb6d8 EFLAGS: 00000246
[ 1152.928620] RAX: 0000000000000001 RBX: 00007f449801e970 RCX: 0000000000000359
[ 1152.928622] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f449801e988
[ 1152.928624] RBP: 00007f449801e970 R08: 0000000000000000 R09: 0000000000000000
[ 1152.928626] R10: 0000000000000001 R11: 0000000000000286 R12: 0000000000000000
[ 1152.928627] R13: 00007f449801e988 R14: 0000563c38c01a70 R15: 0000000000000000
[ 1152.928631]  </TASK>
[ 1152.928632] ================================================================================
[ 1152.935186] wlp2s0: authenticated
[ 1152.938856] wlp2s0: associate with 3e:b6:b7:41:a8:89 (try 1/3)
[ 1152.946174] wlp2s0: RX AssocResp from 3e:b6:b7:41:a8:89 (capab=0x421 status=0 aid=1)
[ 1152.946295] wlp2s0: associated
[ 1152.947171] IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready
[ 1323.615159] NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #80!!!

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.

The source code line mentioned on the log is introduced by commit
e3f25908b0b2e (mac80211: fix regression in sta connection monitor).
The latest commit that touch the file in question is commit
ea5907db2a9ccf (mac80211: fix struct ieee80211_tx_info size, 2022-02-02).

Here is the full bisection log:

git bisect start '--term-bad=oops' '--term-good=ok'
# ok: [09688c0166e76ce2fb85e86b9d99be8b0084cdf9] Linux 5.17-rc8
git bisect ok 09688c0166e76ce2fb85e86b9d99be8b0084cdf9
# oops: [f443e374ae131c168a065ea1748feac6b2e76613] Linux 5.17
git bisect oops f443e374ae131c168a065ea1748feac6b2e76613
# oops: [551acdc3c3d2b6bc97f11e31dcf960bc36343bfc] Merge tag 'net-5.17-final' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
git bisect oops 551acdc3c3d2b6bc97f11e31dcf960bc36343bfc
# oops: [186abea8a80b7699a05bbe6cbd661d64f887e1a0] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
git bisect oops 186abea8a80b7699a05bbe6cbd661d64f887e1a0
# oops: [c700525fcc06b05adfea78039de02628af79e07a] net/packet: fix slab-out-of-bounds access in packet_recvmsg()
git bisect oops c700525fcc06b05adfea78039de02628af79e07a
# oops: [837d9e49402eaf030db55a49f96fc51d73b4b441] net: phy: marvell: Fix invalid comparison in the resume and suspend functions
git bisect oops 837d9e49402eaf030db55a49f96fc51d73b4b441
# ok: [46b348fd2d81a341b15fb3f3f986204b038f5c42] alx: acquire mutex for alx_reinit in alx_change_mtu
git bisect ok 46b348fd2d81a341b15fb3f3f986204b038f5c42
# ok: [e981bc74aefc6a177b50c16cfa7023599799cf74] net: dsa: microchip: add spi_device_id tables
git bisect ok e981bc74aefc6a177b50c16cfa7023599799cf74
# first oops commit: [837d9e49402eaf030db55a49f96fc51d73b4b441] net: phy: marvell: Fix invalid comparison in the resume and suspend functions

Attached is the config to reproduce the issue.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43357 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: UBSAN: invalid-load in net/mac80211/status.c:1164:21
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2022-03-30 13:23 UTC (permalink / raw)
  To: Bagas Sanjaya, 'Linux Kernel'
  Cc: David S. Miller, Jakub Kicinski, linux-wireless, netdev,
	Kurt Cancemi, Andrew Lunn, Toke Høiland-Jørgensen

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?

> 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.

johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: UBSAN: invalid-load in net/mac80211/status.c:1164:21
  2022-03-30 13:23 ` Johannes Berg
@ 2022-03-30 13:46   ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-03-30 13:46 UTC (permalink / raw)
  To: Johannes Berg, Bagas Sanjaya, 'Linux Kernel'
  Cc: David S. Miller, Jakub Kicinski, linux-wireless, netdev,
	Kurt Cancemi, Andrew Lunn

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;
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-30 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).