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]
Date:	Fri, 20 Mar 2009 15:00:10 +0100
From:	Heiko Carstens <heiko.carstens@...ibm.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Ingo Molnar <mingo@...e.hu>, Nick Piggin <npiggin@...e.de>,
	"lkml," <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lockdep: fix deadlock in lockdep_trace_alloc

On Fri, 20 Mar 2009 14:45:00 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
> Subject: lockdep: fix deadlock in lockdep_trace_alloc
> From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Date: Fri Mar 20 11:24:21 CET 2009
> 
> Heiko reported that we grab the graph lock with irqs enabled.
> 
> Fix this by providing the same wrapper as all other lockdep entry
> functions have.
> 
> Reported-by: Heiko Carstens <heiko.carstens@...ibm.com>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> ---
>  kernel/lockdep.c |   21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/kernel/lockdep.c
> ===================================================================
> --- linux-2.6.orig/kernel/lockdep.c
> +++ linux-2.6/kernel/lockdep.c
> @@ -2258,7 +2258,7 @@ void trace_softirqs_off(unsigned long ip
>  		debug_atomic_inc(&redundant_softirqs_off);
>  }
> 
> -void lockdep_trace_alloc(gfp_t gfp_mask)
> +static void __lockdep_trace_alloc(gfp_t gfp_mask, unsigned long flags)
>  {
>  	struct task_struct *curr = current;
> 
> @@ -2277,12 +2277,29 @@ void lockdep_trace_alloc(gfp_t gfp_mask)
>  	if (!(gfp_mask & __GFP_FS))
>  		return;
> 
> -	if (DEBUG_LOCKS_WARN_ON(irqs_disabled()))
> +	if (DEBUG_LOCKS_WARN_ON(raw_irqs_disabled_flags(flags)))
>  		return;
> 
>  	mark_held_locks(curr, RECLAIM_FS);
>  }
> 
> +static void check_flags(unsigned long flags);
> +
> +void lockdep_trace_alloc(gfp_t gfp_mask)
> +{
> +	unsigned long flags;
> +
> +	if (unlikely(current->lockdep_recursion))
> +		return;
> +
> +	raw_local_irq_save(flags);
> +	check_flags(flags);
> +	current->lockdep_recursion = 1;
> +	__lockdep_trace_alloc(gfp_mask, flags);
> +	current->lockdep_recursion = 0;
> +	raw_local_irq_restore(flags);
> +}
> +

This one works ;)

Tested-by: Heiko Carstens <heiko.carstens@...ibm.com>
--
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