From 5529b1b183a2b2a51784fe6ee292bdf9032e8834 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 6 Jun 2018 10:37:25 +0200 Subject: [PATCH] rec: Allocate one more stack byte to make _GLIBCXX_ASSERTIONS happy --- pdns/mtasker.cc | 4 ++-- pdns/mtasker_fcontext.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pdns/mtasker.cc b/pdns/mtasker.cc index 9fcb7d31f..16027b610 100644 --- a/pdns/mtasker.cc +++ b/pdns/mtasker.cc @@ -268,10 +268,10 @@ templatevoid MTasker::makeThread(tfunc_t *start, auto uc=std::make_shared(); uc->uc_link = &d_kernel; // come back to kernel after dying - uc->uc_stack.resize (d_stacksize); + uc->uc_stack.resize (d_stacksize+1); #ifdef PDNS_USE_VALGRIND uc->valgrind_id = VALGRIND_STACK_REGISTER(&uc->uc_stack[0], - &uc->uc_stack[uc->uc_stack.size()]); + &uc->uc_stack[uc->uc_stack.size()-1]); #endif /* PDNS_USE_VALGRIND */ auto& thread = d_threads[d_maxtid]; diff --git a/pdns/mtasker_fcontext.cc b/pdns/mtasker_fcontext.cc index 0ab87b6f6..72627a7e5 100644 --- a/pdns/mtasker_fcontext.cc +++ b/pdns/mtasker_fcontext.cc @@ -216,13 +216,13 @@ pdns_makecontext assert (ctx.uc_link); assert (ctx.uc_stack.size() >= 8192); assert (!ctx.uc_mcontext); - ctx.uc_mcontext = make_fcontext (&ctx.uc_stack[ctx.uc_stack.size()], - ctx.uc_stack.size(), &threadWrapper); + ctx.uc_mcontext = make_fcontext (&ctx.uc_stack[ctx.uc_stack.size()-1], + ctx.uc_stack.size()-1, &threadWrapper); args_t args; args.self = &ctx; args.work = &start; /* jumping to threadwrapper */ - notifyStackSwitch(&ctx.uc_stack[ctx.uc_stack.size()], ctx.uc_stack.size()); + notifyStackSwitch(&ctx.uc_stack[ctx.uc_stack.size()-1], ctx.uc_stack.size()-1); #if BOOST_VERSION < 106100 jump_fcontext (reinterpret_cast(&args.prev_ctx), static_cast(ctx.uc_mcontext), -- 2.40.0