From: Juergen Perlinger Date: Mon, 27 Mar 2017 06:33:02 +0000 (+0200) Subject: [Bug 3391] ntpd segfaults on startup due to small warmup thread stack size X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c89f894d9afb7a44a91bef747aae1ea3feb8b83;p=thirdparty%2Fntp.git [Bug 3391] ntpd segfaults on startup due to small warmup thread stack size bk: 58d8b21ezqNxD_bwGbE3Xf_LKeKIQA --- diff --git a/ChangeLog b/ChangeLog index a1a1cfae4..09dae56d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +--- +* [Bug 3391] ntpd segfaults on startup due to small warmup thread stack size + - increased mimimum stack size to 32kB + --- (4.2.8p10-win-beta1) 2017/03/21 Released by Harlan Stenn (4.2.8p10) diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index a0880be6c..d4204efd8 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -313,11 +313,16 @@ my_pthread_warmup(void) #if defined(HAVE_PTHREAD_ATTR_GETSTACKSIZE) && \ defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && \ defined(PTHREAD_STACK_MIN) - rc = pthread_attr_setstacksize(&thr_attr, PTHREAD_STACK_MIN); - if (0 != rc) - msyslog(LOG_ERR, - "my_pthread_warmup: pthread_attr_setstacksize() -> %s", - strerror(rc)); + { + size_t ssmin = 32*1024; /* 32kB should be minimum */ + if (ssmin < PTHREAD_STACK_MIN) + ssmin = PTHREAD_STACK_MIN; + rc = pthread_attr_setstacksize(&thr_attr, ssmin); + if (0 != rc) + msyslog(LOG_ERR, + "my_pthread_warmup: pthread_attr_setstacksize() -> %s", + strerror(rc)); + } #endif rc = pthread_create( &thread, &thr_attr, my_pthread_warmup_worker, NULL);