]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: do not vmalloc/vfree from probe context
authorKris Van Hees <kris.van.hees@oracle.com>
Mon, 26 Jan 2015 21:19:54 +0000 (16:19 -0500)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:30:00 +0000 (15:30 +0100)
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 <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
kernel/dtrace/dtrace_os.c

index 3e66613e7ee4412acf5b6d4e2fda37745b6690fb..9be9b7379137aa7ea48ff0c8f2244fda7e329b08 100644 (file)
@@ -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;