]> sourceware.org Git - systemtap.git/commitdiff
PR14781: use kmem_cache_create with unique name
authorFrank Ch. Eigler <fche@redhat.com>
Mon, 29 Oct 2012 00:53:11 +0000 (20:53 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Mon, 29 Oct 2012 00:53:11 +0000 (20:53 -0400)
* runtime/stp_utrace.c (utrace_init): Instead of using the KMEM_CACHE macro,
  invoke kmem_cache_create directly, with cache names that are going to be
  unique across concurrent systemtap sessions.

runtime/stp_utrace.c

index 11062c9b9b3a6f7c979a408e6a50af52b9a6492c..5be0eff8c9b0676853a19e0b663b547cf082513e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * utrace infrastructure interface for debugging user processes
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2006-2012 Red Hat, Inc.  All rights reserved.
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -109,6 +109,8 @@ int utrace_init(void)
 {
        int i;
        int rc = -1;
+        static char kmem_cache1_name[50];
+        static char kmem_cache2_name[50];
 
        if (unlikely(stp_task_work_init() != 0))
                goto error;
@@ -118,10 +120,22 @@ int utrace_init(void)
                INIT_HLIST_HEAD(&task_utrace_table[i]);
        }
 
-       utrace_cachep = KMEM_CACHE(utrace, 0);
+        /* PR14781: avoid kmem_cache naming collisions (detected by CONFIG_DEBUG_VM)
+           by plopping a non-conflicting token - in this case the address of a 
+           locally relevant variable - into the names. */
+        snprintf(kmem_cache1_name, sizeof(kmem_cache1_name),
+                 "utrace_%lx", (unsigned long) (& utrace_cachep));
+       utrace_cachep = kmem_cache_create(kmem_cache1_name, 
+                                          sizeof(struct utrace),
+                                          0, 0, NULL);
        if (unlikely(!utrace_cachep))
                goto error;
-       utrace_engine_cachep = KMEM_CACHE(utrace_engine, 0);
+
+        snprintf(kmem_cache2_name, sizeof(kmem_cache2_name),
+                 "utrace_engine_%lx", (unsigned long) (& utrace_engine_cachep));
+       utrace_engine_cachep = kmem_cache_create(kmem_cache2_name, 
+                                                 sizeof(struct utrace_engine),
+                                                 0, 0, NULL);
        if (unlikely(!utrace_engine_cachep))
                goto error;
 
This page took 0.031454 seconds and 5 git commands to generate.