]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: zero-initialize the fake vmlinux module's pdata space
authorNick Alcock <nick.alcock@oracle.com>
Tue, 24 Feb 2015 20:49:14 +0000 (20:49 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:30:04 +0000 (15:30 +0100)
We need to do this because we bypass normal module initialization for this
"module", so move_module() is never called for it and the memory is never zeroed
as it is for real modules.

If this is not done, we end up with a non-initialized pdata which may contain
e.g. a non-zero count of the number of registered SDT probes, even before any
had been registered.  (This would have the effect of preventing the registration
of any SDT probes in the main kernel, forever.)

Orabug: 19005031
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
kernel/dtrace/dtrace_os.c

index 83d0e1122f72ad60734fe643af9e4220b7ff67a9..1201084040206422624dab728087a43e803799ca 100644 (file)
@@ -42,6 +42,8 @@ struct kmem_cache     *psinfo_cachep;
 
 void dtrace_os_init(void)
 {
+       size_t module_size;
+
        if (dtrace_kmod != NULL) {
                pr_warn_once("%s: cannot be called twice\n", __func__);
                return;
@@ -62,14 +64,15 @@ void dtrace_os_init(void)
         *        used for pdata and other related data
         * The memory is allocated from the modules space.
         */
-       dtrace_kmod = module_alloc(ALIGN(sizeof(struct module), 8) +
-                                  DTRACE_PDATA_MAXSIZE);
+       module_size = ALIGN(sizeof(struct module), 8) + DTRACE_PDATA_MAXSIZE;
+       dtrace_kmod = module_alloc(module_size);
        if (dtrace_kmod == NULL) {
                pr_warning("%s: cannot allocate kernel pseudo-module\n",
                           __func__);
                return;
        }
 
+       memset(dtrace_kmod, 0, module_size);
        strlcpy(dtrace_kmod->name, "vmlinux", MODULE_NAME_LEN);
        dtrace_kmod->state = MODULE_STATE_LIVE;
        dtrace_kmod->pdata = (char *)dtrace_kmod +