Re: [patch 00/61] ANNOUNCE: lock validator -V1

From: Ingo Molnar
Date: Tue May 30 2006 - 02:36:38 EST



* Mike Galbraith <efault@xxxxxx> wrote:

> Darn. It said all tests passed, then oopsed.
>
> (have .config all gzipped up if you want it)

yeah, please.

> EIP: 0060:[<b103a872>] Not tainted VLI
> EFLAGS: 00010083 (2.6.17-rc4-mm3-smp #157)
> EIP is at count_matching_names+0x5b/0xa2

> 1151 list_for_each_entry(type, &all_lock_types, lock_entry) {
> 1152 if (new_type->key - new_type->subtype == type->key)
> 1153 return type->name_version;
> 1154 if (!strcmp(type->name, new_type->name)) <--kaboom
> 1155 count = max(count, type->name_version);

hm, while most code (except the one above) is prepared for type->name
being NULL, it should not be NULL. Maybe an uninitialized lock slipped
through? Please try the patch below - it both protects against
type->name being NULL in this place, and will warn if it finds a NULL
lockname.

Ingo

Index: linux/kernel/lockdep.c
===================================================================
--- linux.orig/kernel/lockdep.c
+++ linux/kernel/lockdep.c
@@ -1151,7 +1151,7 @@ int count_matching_names(struct lock_typ
list_for_each_entry(type, &all_lock_types, lock_entry) {
if (new_type->key - new_type->subtype == type->key)
return type->name_version;
- if (!strcmp(type->name, new_type->name))
+ if (type->name && !strcmp(type->name, new_type->name))
count = max(count, type->name_version);
}

@@ -1974,7 +1974,8 @@ void lockdep_init_map(struct lockdep_map

if (DEBUG_WARN_ON(!key))
return;
-
+ if (DEBUG_WARN_ON(!name))
+ return;
/*
* Sanity check, the lock-type key must be persistent:
*/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/