public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* slab.c use of __get_user and sparse
@ 2005-01-15 21:39 Sam Ravnborg
  2005-01-15 22:01 ` Andi Kleen
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2005-01-15 21:39 UTC (permalink / raw)
  To: linux-kernel, Andi Kleen

Hi Andi, lkml.

In slab.c around line 1450 the following code is present:

list_for_each(p, &cache_chain) {
	kmem_cache_t *pc = list_entry(p, kmem_cache_t, next);
	char tmp;
	/* This happens when the module gets unloaded and doesn't
	   destroy its slab cache and noone else reuses the vmalloc
	   area of the module. Print a warning. */
	if (__get_user(tmp,(char __user *) pc->name)) { 
		printk("SLAB: cache with size %d has lost its name\n", 
			pc->objsize); 
		continue; 

sparse emit a warning for the line with __get_user because the pointer
is not marker __user. So the above cast inserted by me made sparse shut up.

Based on the comment it is understood that suddenly this pointer points
to userspace, because the module got unloaded.
I wonder why we can rely on the same address now the module got unloaded -
we may risk this virtual address is taken over by someone else?

Andi - sent to you since you made this change loong time ago.

[mm/ is sparse clean with defconfig when this is fixed].

	Sam

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

end of thread, other threads:[~2005-01-16 21:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-15 21:39 slab.c use of __get_user and sparse Sam Ravnborg
2005-01-15 22:01 ` Andi Kleen
2005-01-15  9:22   ` Andreas Gruenbacher
2005-01-16 21:22     ` Andreas Dilger
2005-01-15 22:24   ` Al Viro
2005-01-15 22:25   ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox