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: <20080819164830.GA2533@ami.dom.local>
Date:	Tue, 19 Aug 2008 18:48:31 +0200
From:	Jarek Poplawski <jarkao2@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	herbert@...dor.apana.org.au, netdev@...r.kernel.org
Subject: Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().

David Miller wrote, On 08/19/2008 01:02 PM:

> From: Herbert Xu <herbert@...dor.apana.org.au>
> Date: Tue, 19 Aug 2008 20:58:15 +1000
> 
>> On Tue, Aug 19, 2008 at 08:55:51PM +1000, Herbert Xu wrote:
>>> On Tue, Aug 19, 2008 at 03:54:06AM -0700, David Miller wrote:
>>>> Every qdisc_run() will invoke __netif_schedule() so it is
>>>> a fast path I think :-)
>>> Argh, I meant __netif_reschedule which shouldn't be the fast path.
>> Nevermind, both paths call __netif_reschedule :)
>>

I can miss something, but probably it's needed in __netif_reschedule()
yet. Here is a scenario:

cpu1				cpu2
dev_deactivate()
dev_deactivate_queue()
qdisc_reset()
				qdisc_run()
				qdisc_watchdog_schedule()
				(or hrtimer_restart in cbq)
while (some_qdisc_is_busy())
return (qdisc not busy)
				hrtimer triggered
				__netif_schedule()
qdisc_destroy()			qdisc_run()
		
Jarek P.

>> OK, how about just moving it to the else clause in net_tx_action?
> 
> I just checked the following into net-2.6
> 
> pkt_sched: Prevent livelock in TX queue running.
> 
> If dev_deactivate() is trying to quiesce the queue, it
> is theoretically possible for another cpu to livelock
> trying to process that queue.  This happens because
> dev_deactivate() grabs the queue spinlock as it checks
> the queue state, whereas net_tx_action() does a trylock
> and reschedules the qdisc if it hits the lock.
> 
> This breaks the livelock by adding a check on
> __QDISC_STATE_DEACTIVATED to net_tx_action() when
> the trylock fails.
> 
> Based upon feedback from Herbert Xu and Jarek Poplawski.
> 
> Signed-off-by: David S. Miller <davem@...emloft.net>
> ---
>  net/core/dev.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8d13380..60c51f7 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1990,7 +1990,9 @@ static void net_tx_action(struct softirq_action *h)
>  				qdisc_run(q);
>  				spin_unlock(root_lock);
>  			} else {
> -				__netif_reschedule(q);
> +				if (!test_bit(__QDISC_STATE_DEACTIVATED,
> +					      &q->state))
> +					__netif_reschedule(q);
>  			}
>  		}
>  	}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ