From efd82289c2b5cfcf30aa936c6606e37c19773b15 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Mon, 24 Mar 2014 22:50:06 +0000 Subject: [PATCH] Drop CPU_DTRACE_NOFAULT manipulation around ustack calls. dtrace_getufpstack() and (as of the last commit) dtrace_getustackdepth() both manipulate the CPU_DTRACE_NOFAULT flag themselves: clearing it after calling those functions is redundant, and setting it is actually dangerous, since other functions dtrace_getustackdepth() calls (such as __get_user_pages() do not expect to have instructions that incur page faults silently skipped without faulting. Orabug: 18412802 Signed-off-by: Nick Alcock Reviewed-by: Kris Van Hees Acked-by: Chuck Anderson --- dtrace/dtrace_dif.c | 10 +++------- dtrace/dtrace_probe.c | 4 ---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/dtrace/dtrace_dif.c b/dtrace/dtrace_dif.c index 64e1afc5177e..772e32e6c2cf 100644 --- a/dtrace/dtrace_dif.c +++ b/dtrace/dtrace_dif.c @@ -2134,12 +2134,9 @@ static uint64_t dtrace_dif_variable(dtrace_mstate_t *mstate, if (DTRACE_ANCHORED(mstate->dtms_probe) && in_interrupt()) mstate->dtms_ustackdepth = 0; - else { - DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); + else mstate->dtms_ustackdepth = - dtrace_getustackdepth(); - DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); - } + dtrace_getustackdepth(); mstate->dtms_present |= DTRACE_MSTATE_USTACKDEPTH; } @@ -2199,9 +2196,8 @@ static uint64_t dtrace_dif_variable(dtrace_mstate_t *mstate, * will contain the caller, which is what we're after. */ ustack[3] = 0; - DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_getupcstack(ustack, 4); - DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); + mstate->dtms_ucaller = ustack[3]; mstate->dtms_present |= DTRACE_MSTATE_UCALLER; } diff --git a/dtrace/dtrace_probe.c b/dtrace/dtrace_probe.c index b6d69b46838b..5076765a1f2c 100644 --- a/dtrace/dtrace_probe.c +++ b/dtrace/dtrace_probe.c @@ -494,9 +494,7 @@ static void dtrace_action_ustack(dtrace_mstate_t *mstate, /* * Now get a stack with both program counters and frame pointers. */ - DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_getufpstack(buf, fps, nframes + 2); - DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); /* * If that faulted, we're cooked. @@ -935,12 +933,10 @@ void dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, continue; } - DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_getupcstack( (uint64_t *)(tomax + valoffs), DTRACE_USTACK_NFRAMES(rec->dtrd_arg) + 2); - DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); continue; default: -- 2.50.1