]> granicus.if.org Git - pdns/commitdiff
rec: Allocate one more stack byte to make _GLIBCXX_ASSERTIONS happy
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 6 Jun 2018 08:37:25 +0000 (10:37 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 6 Jun 2018 08:37:25 +0000 (10:37 +0200)
pdns/mtasker.cc
pdns/mtasker_fcontext.cc

index 9fcb7d31f2dd6fd5dc58447c6a8611c2ba3caf49..16027b61011f488f82a238e08b9635fa74727a20 100644 (file)
@@ -268,10 +268,10 @@ template<class Key, class Val>void MTasker<Key,Val>::makeThread(tfunc_t *start,
   auto uc=std::make_shared<pdns_ucontext_t>();
   
   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];
index 0ab87b6f6cc38c66dbd309ebadfb3710b5c028b9..72627a7e5ccce979cbe2cbeffbaa59bf1cf46f48 100644 (file)
@@ -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<fcontext_t*>(&args.prev_ctx),
                    static_cast<fcontext_t>(ctx.uc_mcontext),