From df2a97c99c651bfde9daf496e0ba02aa829dc098 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Thu, 17 Oct 2013 05:45:22 -0400 Subject: [PATCH] dtrace: ensure userspace stack memory access cannot page fault Orabug: 17591351 Signed-off-by: Kris Van Hees --- dtrace/dtrace_isa.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 428db59a2d94..605ec9df2d05 100644 --- a/dtrace/dtrace_isa.c +++ b/dtrace/dtrace_isa.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #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. */ -- 2.50.1