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] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFFsh6kFOkhGOO7Q@gmail.com>
Date: Tue, 17 Jun 2025 06:24:23 -0700
From: Breno Leitao <leitao@...ian.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	David Wei <dw@...idwei.uk>, Shuah Khan <shuah@...nel.org>,
	Simon Horman <horms@...nel.org>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
	gustavold@...il.com
Subject: Re: [PATCH net-next v3 4/4] netdevsim: account dropped packet length
 in stats on queue free

On Tue, Jun 17, 2025 at 05:59:34AM -0700, Jakub Kicinski wrote:
> On Tue, 17 Jun 2025 01:19:00 -0700 Breno Leitao wrote:
> > -static void nsim_queue_free(struct nsim_rq *rq)
> > +static void nsim_queue_free(struct net_device *dev, struct nsim_rq *rq)
> >  {
> >  	hrtimer_cancel(&rq->napi_timer);
> > +	dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen);
> 
> here we are in process context and debug checks complain about the use
> of this_cpu_ptr(). Let's wrap this in local_bh_disable() / enable() ?

Thanks. I was able to reproduce it. Your suggestion avoids the complain.
I suppose we should just wrap dev_dstats_rx_dropped_add(), right?

	diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
	index 5d0b801e81129..07171cf8b07ee 100644
	--- a/drivers/net/netdevsim/netdev.c
	+++ b/drivers/net/netdevsim/netdev.c
	@@ -635,7 +635,9 @@ static struct nsim_rq *nsim_queue_alloc(void)
	static void nsim_queue_free(struct net_device *dev, struct nsim_rq *rq)
	{
		hrtimer_cancel(&rq->napi_timer);
	+	local_bh_disable();
		dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen);
	+	local_bh_enable();
		skb_queue_purge_reason(&rq->skb_queue, SKB_DROP_REASON_QUEUE_PURGE);
		kfree(rq);
	}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ