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]
Date:	Mon, 11 Aug 2008 14:38:45 +0800
From:	Huang Ying <ying.huang@...el.com>
To:	Rabin Vincent <rabin@....in>
Cc:	Eric Sesterhenn <snakebyte@....de>, linux-kernel@...r.kernel.org,
	peterz@...radead.org, mingo@...hat.com
Subject: Re: [PATCH] lockdep: handle chains involving classes defined in
	modules

On Sat, 2008-08-09 at 03:55 +0530, Rabin Vincent wrote:
> On Fri, Aug 08, 2008 at 11:24:37AM +0800, Huang Ying wrote:
> > On Fri, 2008-08-08 at 02:27 +0530, Rabin Vincent wrote:
> > > /proc/lockdep_chains currently oopses after any module which creates and
> > > uses a lock is unloaded.  This is because one of the chains involves a
> > > class which was defined in the module just unloaded.
> > > 
> > > The classes are already correctly taken care of using the
> > > all_lock_classes which keeps track of all active lock classses.  Add a
> > > similar all_lock_chains list and use it for keeping track of chains.
> > > 
> [...]
> > 
> > I think there is a simpler method to deal with this.
> 
> Yes.  I went with the all_lock_chains list approach because there was
> similar code already being used to keep track of lock_class structures.
> 
> > - Mark class as useless during zap_class()
> > - When output lock_chain, if some classes are useless, do not output the
> > class.
> 
> Like the patch below?  I set ->key to NULL after zapping the class and
> use that as a condition to not print the class' information.  The only
> issue is that with this patch there will be some chains output with no
> locks listed under them.
> 
> ---
>     lockdep: handle chains involving classes defined in modules
>     
>     /proc/lockdep_chains currently oopses after any module which creates and
>     uses a lock is unloaded.  This is because one of the chains involves a
>     class which was defined in the module just unloaded.
>     
>     Solve this by marking the classes as unused and not printing information
>     about the unused classes.
>     
>     Reported-by: Eric Sesterhenn <snakebyte@....de>
>     Signed-off-by: Rabin Vincent <rabin@....in>
> 
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index d38a643..8ade874 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -2988,6 +2988,7 @@ static void zap_class(struct lock_class *class)
>  	list_del_rcu(&class->hash_entry);
>  	list_del_rcu(&class->lock_entry);
>  
> +	class->key = NULL;
>  }
>  
>  static inline int within(const void *addr, void *start, unsigned long size)
> diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
> index 9b0e940..f09b6c7 100644
> --- a/kernel/lockdep_proc.c
> +++ b/kernel/lockdep_proc.c
> @@ -229,6 +229,9 @@ static int lc_show(struct seq_file *m, void *v)
>  
>  	for (i = 0; i < chain->depth; i++) {
>  		class = lock_chain_get_class(chain, i);
> +		if (!class->key)
> +			continue;
> +
>  		seq_printf(m, "[%p] ", class->key);
>  		print_name(m, class);
>  		seq_puts(m, "\n");

I think this patch is OK.

Acked-by: Huang Ying <ying.huang@...el.com>

Best Regards,
Huang Ying


--
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