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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120622195213.GA18467@leaf>
Date:	Fri, 22 Jun 2012 12:52:13 -0700
From:	Josh Triplett <josh@...htriplett.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
	dipankar@...ibm.com, akpm@...ux-foundation.org,
	mathieu.desnoyers@...icios.com, niv@...ibm.com, tglx@...utronix.de,
	peterz@...radead.org, rostedt@...dmis.org, Valdis.Kletnieks@...edu,
	dhowells@...hat.com, eric.dumazet@...il.com, darren@...art.com,
	fweisbec@...il.com, sbw@....edu, patches@...aro.org
Subject: Re: [PATCH tip/core/urgent] rcu: Stop rcu_do_batch() from
 multiplexing the "count" variable

On Fri, Jun 22, 2012 at 08:37:38AM -0700, Paul E. McKenney wrote:
> Commit b1420f1c (Make rcu_barrier() less disruptive) rearranged the
> code in rcu_do_batch(), moving the ->qlen manipulation to follow
> the requeueing of the callbacks.  Unfortunately, this rearrangement
> clobbered the value of the "count" local variable before the value
> of rdp->qlen was adjusted, resulting in the value of rdp->qlen being
> inaccurate.  This commit therefore introduces an index variable "i",
> avoiding the inadvertent multiplexing.
> 
> Signed-off-by: Paul E. McKenney <paul.mckenney@...aro.org>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>

Reviewed-by: Josh Triplett <josh@...htriplett.org>

> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index 2f34d02..2001d38 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -1593,7 +1593,7 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
>  {
>  	unsigned long flags;
>  	struct rcu_head *next, *list, **tail;
> -	int bl, count, count_lazy;
> +	int bl, count, count_lazy, i;
>  
>  	/* If no callbacks are ready, just return.*/
>  	if (!cpu_has_callbacks_ready_to_invoke(rdp)) {
> @@ -1616,9 +1616,9 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
>  	rdp->nxtlist = *rdp->nxttail[RCU_DONE_TAIL];
>  	*rdp->nxttail[RCU_DONE_TAIL] = NULL;
>  	tail = rdp->nxttail[RCU_DONE_TAIL];
> -	for (count = RCU_NEXT_SIZE - 1; count >= 0; count--)
> -		if (rdp->nxttail[count] == rdp->nxttail[RCU_DONE_TAIL])
> -			rdp->nxttail[count] = &rdp->nxtlist;
> +	for (i = RCU_NEXT_SIZE - 1; i >= 0; i--)
> +		if (rdp->nxttail[i] == rdp->nxttail[RCU_DONE_TAIL])
> +			rdp->nxttail[i] = &rdp->nxtlist;
>  	local_irq_restore(flags);
>  
>  	/* Invoke callbacks. */
> @@ -1646,9 +1646,9 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
>  	if (list != NULL) {
>  		*tail = rdp->nxtlist;
>  		rdp->nxtlist = list;
> -		for (count = 0; count < RCU_NEXT_SIZE; count++)
> -			if (&rdp->nxtlist == rdp->nxttail[count])
> -				rdp->nxttail[count] = tail;
> +		for (i = 0; i < RCU_NEXT_SIZE; i++)
> +			if (&rdp->nxtlist == rdp->nxttail[i])
> +				rdp->nxttail[i] = tail;
>  			else
>  				break;
>  	}
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ