DTrace aarch64: Avoid calling unwind_frame() in the probe context.

unwind_frame() may be instrumented by FBT, leading to recursion into
dtrace_probe(). Manually inline unwind_frame() as we do with stack
unwinding code for other architectures.

Submitted by:	Domagoj Stolfa
Reviewed by:	manu
MFC after:	1 week
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D15359
This commit is contained in:
Mark Johnston 2018-05-12 15:35:26 +00:00
parent 09e24fbe18
commit 5f05bda607
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=333570

View File

@ -70,7 +70,7 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
{
struct unwind_state state;
int scp_offset;
register_t sp;
register_t sp, fp;
int depth;
depth = 0;
@ -88,12 +88,16 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
state.pc = (uint64_t)dtrace_getpcstack;
while (depth < pcstack_limit) {
if (unwind_frame(&state))
break;
if (!INKERNEL(state.pc) || !INKERNEL(state.fp))
break;
fp = state.fp;
state.sp = fp + 0x10;
/* FP to previous frame (X29) */
state.fp = *(register_t *)(fp);
/* LR (X30) */
state.pc = *(register_t *)(fp + 8) - 4;
/*
* NB: Unlike some other architectures, we don't need to
* explicitly insert cpu_dtrace_caller as it appears in the