lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 01 Oct 2019 12:00:52 +0200
From:   Johannes Berg <johannes@...solutions.net>
To:     Aaron Hill <aa1ronham@...il.com>, linux-wireless@...r.kernel.org
Cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, Jiri Kosina <jikos@...nel.org>,
        Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH] net: mac80211: Disable preeemption when updating stat
 counters

On Fri, 2019-09-27 at 11:41 -0400, Aaron Hill wrote:
> The mac80211 subsystem maintains per-cpu stat counters for receive and
> transmit operations. Previously, preemption was not disabled when
> updating these counters. This creates a race condition where two cpus
> could attempt to update the same counters using non-atomic operations.
> 
> This was causing a
> 'BUG: using smp_processor_id() in preemptible [00000000] code'
> message to be printed, along with a stacktrace. This was reported
> in a few different places:
> 
> * https://www.spinics.net/lists/linux-wireless/msg189992.html
> * https://bugzilla.kernel.org/show_bug.cgi?id=204127
> 
> This patch adds calls to preempt_disable() and preempt_enable()
> surrounding the updating of the stat counters.

That seems like basically the same as what Jiri reported, but now I'm
even more confused...

Ah. CONFIG_PREEMPT_RCU...

But if we keep BHs disabled, it should still be OK, so what I suggested
to Jiri will also address this I think?

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 051a02ddcb85..ad1e88958da2 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -273,9 +273,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
 						&txqi->flags))
 				continue;
 
-			spin_unlock_bh(&fq->lock);
+			spin_unlock(&fq->lock);
 			drv_wake_tx_queue(local, txqi);
-			spin_lock_bh(&fq->lock);
+			spin_lock(&fq->lock);
 		}
 	}
 

johannes

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ