slab.c use of __get_user and sparse
From: Sam Ravnborg
Date: Sat Jan 15 2005 - 16:39:51 EST
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
-
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/