Permalink
Browse files

Potential fix for #1907, we now try to trigger libgcc_s.so.1 to load …

…before we chroot. I can't reproduce the bug on my local system,

but this "should" help. Seriously.
  • Loading branch information...
1 parent 0f2f999 commit 1c57e1ddf9205766e9c43611df93f04b759d2ae3 @ahupowerdns ahupowerdns committed with mind04 Dec 6, 2014
Showing with 15 additions and 0 deletions.
  1. +15 −0 pdns/common_startup.cc
@@ -350,6 +350,20 @@ void *qthread(void *number)
return 0;
}
+static void* dummyThread(void *)
+{
+ void* ignore=0;
+ pthread_exit(ignore);
+}
+
+static void triggerLoadOfLibraries()
+{
+ pthread_t tid;
+ pthread_create(&tid, 0, dummyThread, 0);
+ void* res;
+ pthread_join(tid, &res);
+}
+
void mainthread()
{
Utility::srandom(time(0));
@@ -369,6 +383,7 @@ void mainthread()
doSecPoll(true); // this must be BEFORE chroot
if(!::arg()["chroot"].empty()) {
+ triggerLoadOfLibraries();
if(::arg().mustDo("master") || ::arg().mustDo("slave"))
gethostbyname("a.root-servers.net"); // this forces all lookup libraries to be loaded
Utility::dropGroupPrivs(newuid, newgid);

0 comments on commit 1c57e1d

Please sign in to comment.