The tets file: $ cat bug.c // how to crash: gcc -O0 -ggdb3 -o r bug.c -pthread && ./r #include <pthread.h> static void * f (void * p) { return NULL; } int main (int argc, const char ** argv) { pthread_t t; pthread_create (&t, NULL, &f, NULL); pthread_join (t, NULL); return 0; } How to crash: $ gcc -O0 -ggdb3 -o r bug.c -pthread && ./r Segmentation fault (core dumped) $ gdb r core ... Program terminated with signal SIGSEGV, Segmentation fault. #0 0x2000000000077da0 in start_thread (arg=0x0) at pthread_create.c:432 432 __madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED); [Current thread is 1 (Thread 0x2000000000b6b1f0 (LWP 20912))] (gdb) list 427 #ifdef _STACK_GROWS_DOWN 428 char *sp = CURRENT_STACK_FRAME; 429 size_t freesize = (sp - (char *) pd->stackblock) & ~pagesize_m1; 430 assert (freesize < pd->stackblock_size); 431 if (freesize > PTHREAD_STACK_MIN) 432 __madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED); 433 #else 434 /* Page aligned start of memory to free (higher than or equal 435 to current sp plus the minimum stack size). */ 436 void *freeblock = (void*)((size_t)(CURRENT_STACK_FRAME #0 0x2000000000077da0 in start_thread (arg=0x0) at pthread_create.c:432 pd = 0x0 now = <optimized out> unwind_buf = <error reading variable unwind_buf (Cannot access memory at address 0xfffffffffffffd90)> not_first_call = <optimized out> pagesize_m1 = <optimized out> sp = 0x2000000000b6a870 "" freesize = <optimized out> __PRETTY_FUNCTION__ = "start_thread" #1 0x0000000000000000 in ?? ()
Filed https://sourceware.org/bugzilla/show_bug.cgi?id=21672 upstream and attached patch.
Created attachment 478018 [details, diff] 0001-fix-pthread_create-crash-in-ia64.patch
http://trofi.github.io/posts/202-stack-growth-direction-how-hard-can-it-be.html on why I think patch works :)
Added to 2.26 patchset (>=1)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02056778ea5961e77a59a7a246b355c1225c7404 commit 02056778ea5961e77a59a7a246b355c1225c7404 Author: Andreas K. Hüttel <dilfridge@gentoo.org> AuthorDate: 2017-11-12 12:28:38 +0000 Commit: Andreas K. Hüttel <dilfridge@gentoo.org> CommitDate: 2017-11-12 14:15:28 +0000 sys-libs/glibc: Re-add keywords to glibc 2.26 Bug: https://bugs.gentoo.org/492814 Bug: https://bugs.gentoo.org/622694 Bug: https://bugs.gentoo.org/617938 Bug: https://bugs.gentoo.org/466176 Bug: https://bugs.gentoo.org/628768 Bug: https://bugs.gentoo.org/637016 Bug: https://bugs.gentoo.org/636934 Bug: https://bugs.gentoo.org/381391 Bug: https://bugs.gentoo.org/636158 Package-Manager: Portage-2.3.13, Repoman-2.3.4 sys-libs/glibc/glibc-2.26-r3.ebuild | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)}
sys-libs/glibc-2.26-r7 was stabled with fix included in bug #657148