RE: my slab cache broken on sparc64

From: Holzrichter, Bruce (bruce.holzrichter@monster.com)
Date: Fri May 03 2002 - 22:15:56 EST


>
>It would work if the access was surrounded by:
>
> old_fs = get_fs();
> set_fs(KERNEL_DS);
> ... get_user(kernel_pointer) ...
> set_fs (old_fs);
>
>But it is not.

For what it's worth to you, the below patch fixes this issue, at least on my
box. I have patched and tested on my Ultra5. Thanks for the help!

Bruce H.

--- linus-2.5/mm/slab.c Wed May 1 08:38:46 2002
+++ sparctest/mm/slab.c Fri May 3 22:59:24 2002
@@ -846,11 +846,14 @@
                         /* 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. */
+ mm_segment_t old_fs = get_fs();
+ set_fs(KERNEL_DS);
                         if (__get_user(tmp,pc->name)) {
                                 printk("SLAB: cache with size %d has lost
its name\n",
                                         pc->objsize);
                                 continue;
- }
+ }
+ set_fs(old_fs);
                         if (!strcmp(pc->name,name)) {
                                 printk("kmem_cache_create: duplicate cache
%s\n",name);
                                 up(&cache_chain_sem);
@@ -1963,10 +1966,13 @@
 
         name = cachep->name;
         {
- char tmp;
+ char tmp;
+ mm_segment_t old_fs = get_fs();
+ set_fs(KERNEL_DS);
         if (__get_user(tmp, name))
- name = "broken";
- }
+ name = "broken";
+ set_fs(old_fs);
+ }
 
         seq_printf(m, "%-17s %6lu %6lu %6u %4lu %4lu %4u",
                 name, active_objs, num_objs, cachep->objsize,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 07 2002 - 22:00:22 EST