]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: ensure userspace stack memory access cannot page fault
authorKris Van Hees <kris.van.hees@oracle.com>
Thu, 17 Oct 2013 09:45:22 +0000 (05:45 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Thu, 17 Oct 2013 09:45:22 +0000 (05:45 -0400)
Orabug: 17591351

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
dtrace/dtrace_isa.c

index 428db59a2d94ab1f5c84fb0bf1e0ec5dac9dc298..605ec9df2d05a2f0ca60f09415bc83cb2cf7d7c2 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/hardirq.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/uaccess.h>
 #include <asm/stacktrace.h>
 
 #include "dtrace.h"
@@ -297,7 +298,14 @@ void dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack,
 
        for (sp = (unsigned long *)tos;
             sp <= (unsigned long *)bos && pcstack_limit; sp++) {
-               unsigned long   addr = *sp;
+               unsigned long   addr;
+
+               DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+               get_user(addr, sp);
+               DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+               if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT))
+                       break;
 
                if (addr >= tos && addr <= bos) {
                        /* stack address - may need it for the fpstack. */