diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2018-03-06 12:11:37 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2018-03-06 12:11:37 +0300 |
commit | 1e5079d215643295cba69ce9d0999bf3c5f5df38 (patch) | |
tree | 63c8348d9601c5c52b0f3110fa4c8233751a00c9 /accel-pppd | |
parent | c45d48bf3dd7776a41deb8276ef84cf74cbce6d8 (diff) | |
download | accel-ppp-1e5079d215643295cba69ce9d0999bf3c5f5df38.tar.gz accel-ppp-1e5079d215643295cba69ce9d0999bf3c5f5df38.zip |
triton: prevent alloc_context function to be inlined (fixes improper stack size calculation)
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/triton/triton.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c index 999a38b2..00a93f30 100644 --- a/accel-pppd/triton/triton.c +++ b/accel-pppd/triton/triton.c @@ -105,6 +105,7 @@ static void* triton_thread(struct _triton_thread_t *thread) { sigset_t set; int sig, need_free; + void *stack; sigfillset(&set); sigdelset(&set, SIGKILL); @@ -133,8 +134,8 @@ static void* triton_thread(struct _triton_thread_t *thread) if (this_ctx->before_switch) this_ctx->before_switch(this_ctx, thread->ctx->bf_arg); - *(void *volatile *)alloca(thread->ctx->uc->uc_stack.ss_size + 64); - barrier(); + stack = alloca(thread->ctx->uc->uc_stack.ss_size + 64); + asm volatile("" :: "m" (stack)); memcpy(thread_frame - thread->ctx->uc->uc_stack.ss_size, thread->ctx->uc->uc_stack.ss_sp, thread->ctx->uc->uc_stack.ss_size); setcontext(thread->ctx->uc); @@ -473,7 +474,7 @@ void triton_context_print(void) printf("%p\n", ctx); } -static ucontext_t *alloc_context() +static ucontext_t * __attribute__((noinline)) alloc_context() { ucontext_t *uc; void *frame = __builtin_frame_address(0); |