All of lore.kernel.org
 help / color / mirror / Atom feed
* + mutex-debug-check-mutex-magic-before-owner.patch added to -mm tree
@ 2008-04-27 20:47 akpm
  2008-04-27 20:54 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2008-04-27 20:47 UTC (permalink / raw)
  To: mm-commits; +Cc: jk, a.p.zijlstra, mingo


The patch titled
     mutex-debug: check mutex magic before owner
has been added to the -mm tree.  Its filename is
     mutex-debug-check-mutex-magic-before-owner.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: mutex-debug: check mutex magic before owner
From: Jeremy Kerr <jk@ozlabs.org>

Currently, the mutex debug code checks the lock->owner before lock->magic, so
a corrupt mutex will most likely result in failing the owner check, rather
than the magic check.

This change to debug_mutex_unlock does the magic check first, so
we have a better idea of what breaks.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/mutex-debug.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN kernel/mutex-debug.c~mutex-debug-check-mutex-magic-before-owner kernel/mutex-debug.c
--- a/kernel/mutex-debug.c~mutex-debug-check-mutex-magic-before-owner
+++ a/kernel/mutex-debug.c
@@ -79,8 +79,8 @@ void debug_mutex_unlock(struct mutex *lo
 	if (unlikely(!debug_locks))
 		return;
 
-	DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
 	DEBUG_LOCKS_WARN_ON(lock->magic != lock);
+	DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
 	DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
 	DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
 }
_

Patches currently in -mm which might be from jk@ozlabs.org are

origin.patch
mutex-debug-check-mutex-magic-before-owner.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: + mutex-debug-check-mutex-magic-before-owner.patch added to -mm tree
  2008-04-27 20:47 + mutex-debug-check-mutex-magic-before-owner.patch added to -mm tree akpm
@ 2008-04-27 20:54 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2008-04-27 20:54 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, jk, mingo

On Sun, 2008-04-27 at 13:47 -0700, akpm@linux-foundation.org wrote:
> The patch titled
>      mutex-debug: check mutex magic before owner
> has been added to the -mm tree.  Its filename is
>      mutex-debug-check-mutex-magic-before-owner.patch
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
> 
> See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
> out what to do about this
> 
> The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
> 
> ------------------------------------------------------
> Subject: mutex-debug: check mutex magic before owner
> From: Jeremy Kerr <jk@ozlabs.org>
> 
> Currently, the mutex debug code checks the lock->owner before lock->magic, so
> a corrupt mutex will most likely result in failing the owner check, rather
> than the magic check.
> 
> This change to debug_mutex_unlock does the magic check first, so
> we have a better idea of what breaks.
> 
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>

Acked-by; Peter Zijlstra <a.p.zijlstra@chello.nl>

> Cc: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  kernel/mutex-debug.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -puN kernel/mutex-debug.c~mutex-debug-check-mutex-magic-before-owner kernel/mutex-debug.c
> --- a/kernel/mutex-debug.c~mutex-debug-check-mutex-magic-before-owner
> +++ a/kernel/mutex-debug.c
> @@ -79,8 +79,8 @@ void debug_mutex_unlock(struct mutex *lo
>  	if (unlikely(!debug_locks))
>  		return;
>  
> -	DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
>  	DEBUG_LOCKS_WARN_ON(lock->magic != lock);
> +	DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
>  	DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
>  	DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
>  }
> _
> 
> Patches currently in -mm which might be from jk@ozlabs.org are
> 
> origin.patch
> mutex-debug-check-mutex-magic-before-owner.patch
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-27 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-27 20:47 + mutex-debug-check-mutex-magic-before-owner.patch added to -mm tree akpm
2008-04-27 20:54 ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.