From d4ddf85c920bf09ba11e548ef405d0330eee2108 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Tue, 24 Feb 2015 20:49:14 +0000 Subject: [PATCH] dtrace: zero-initialize the fake vmlinux module's pdata space 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 Reviewed-by: Kris Van Hees --- kernel/dtrace/dtrace_os.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/dtrace/dtrace_os.c b/kernel/dtrace/dtrace_os.c index 83d0e1122f72..120108404020 100644 --- a/kernel/dtrace/dtrace_os.c +++ b/kernel/dtrace/dtrace_os.c @@ -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 + -- 2.50.1