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]
Message-ID: <20061219132209.GA4139@ff.dom.local>
Date:	Tue, 19 Dec 2006 14:22:09 +0100
From:	Jarek Poplawski <jarkao2@...pl>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	linux-kernel@...r.kernel.org, Andrew Morton <akpm@...l.org>,
	Linus Torvalds <torvalds@...l.org>
Subject: Re: [patch] lockdep: more unlock-on-error fixes, fix

On Tue, Dec 19, 2006 at 10:50:47AM +0100, Ingo Molnar wrote:
...
> moving the graph unlock back, and by leaving the max_lockdep_depth
> variable update possibly racy. (we dont care, it's just statistics)

I would agree if it were not the lockdep.
I mean it's like the "father figure"!

> also add some minimal debugging code to graph_unlock()/graph_lock(), 
> which caught this locking bug.
> 
> Signed-off-by: Ingo Molnar <mingo@...e.hu>
> ---
>  kernel/lockdep.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> Index: linux/kernel/lockdep.c
> ===================================================================
> --- linux.orig/kernel/lockdep.c
> +++ linux/kernel/lockdep.c
> @@ -70,6 +70,9 @@ static int graph_lock(void)
>  
>  static inline int graph_unlock(void)
>  {
> +	if (debug_locks && !__raw_spin_is_locked(&lockdep_lock))
> +		return DEBUG_LOCKS_WARN_ON(1);
> +
>  	__raw_spin_unlock(&lockdep_lock);
>  	return 0;
>  }
> @@ -716,6 +719,9 @@ find_usage_backwards(struct lock_class *
>  	struct lock_list *entry;
>  	int ret;
>  
> +	if (!__raw_spin_is_locked(&lockdep_lock))
> +		return DEBUG_LOCKS_WARN_ON(1);
> +
>  	if (depth > max_recursion_depth)
>  		max_recursion_depth = depth;
>  	if (depth >= RECURSION_LIMIT)
> @@ -2208,6 +2214,7 @@ out_calc_hash:
>  		if (!chain_head && ret != 2)
>  			if (!check_prevs_add(curr, hlock))
>  				return 0;
> +		graph_unlock();
>  	} else
>  		/* after lookup_chain_cache(): */
>  		if (unlikely(!debug_locks))

Probably similar changes should be done in
debug_locks_off_graph_unlock() etc.

I think it's going slightly complicated - there is
hard to say where and when the lock is really on. 
Maybe graph_lock needs some rethinking?

My proposal is to do unconditional locking in
graph_lock() and always check its return value e.g.:

if (!graph_lock()) {
	graph_unlock();
	return 0;
}

It is clear and gives some place for exceptions.
 
Jarek P.

PS: thanks for this followup_to info!
-
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