From 78ae543a2a16bc91eff67f7b096996d593fdb893 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Mon, 26 Jan 2015 16:19:54 -0500 Subject: [PATCH] dtrace: do not vmalloc/vfree from probe context The dtrace_stacktrace() code was using vmalloc/vfree in cases where no array for PCs was provided (as was the case for getting the stackdepth). When this code gets called from probe context, we might be processing an interrupt or trap, and it is not safe to use vmalloc/vfree in that context. We now pass in a (pre-allocated) scratch buffer instead. Orabug: 20456889 Signed-off-by: Kris Van Hees Acked-by: Nick Alcock --- kernel/dtrace/dtrace_os.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kernel/dtrace/dtrace_os.c b/kernel/dtrace/dtrace_os.c index 3e66613e7ee44..9be9b7379137a 100644 --- a/kernel/dtrace/dtrace_os.c +++ b/kernel/dtrace/dtrace_os.c @@ -391,9 +391,10 @@ void dtrace_stacktrace(stacktrace_state_t *st) trace.entries = (typeof(trace.entries))st->pcs; trace.skip = st->depth; - if (st->pcs == NULL) - trace.entries = vmalloc(trace.max_entries * - sizeof(trace.entries[0])); + if (st->pcs == NULL) { + st->depth = 0; + return; + } save_stack_trace(&trace); @@ -410,9 +411,6 @@ void dtrace_stacktrace(stacktrace_state_t *st) st->depth = trace.nr_entries; #endif - if (st->pcs == NULL) - vfree(trace.entries); - if (st->fps != NULL) { for (i = 0; i < st->limit; i++) st->fps[i] = 0; -- 2.50.1