From: Jim Meyering Date: Sat, 11 Dec 2010 10:38:21 +0000 (+0100) Subject: sort: avoid segfault when using two or more threads X-Git-Tag: v8.8~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad61335bf832937dd95739c70405db9b61ffda37;p=thirdparty%2Fcoreutils.git sort: avoid segfault when using two or more threads This change does not fix the actual bug. That was done by commit c9db0ac6, "sort: preallocate merge tree nodes to heap". The fix was to store each "node" structure on the heap, not on the stack. Otherwise, a node from one thread's stack could be used in another thread after the first thread had expired (via pthread_join). This bug was very hard to trigger when using spinlocks, but easier once we began using mutexes. * NEWS (Bug fixes): Mention it. For details, see http://debbugs.gnu.org/7597. --- diff --git a/NEWS b/NEWS index 9f55cbb6ea..b0a11b1102 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ GNU coreutils NEWS -*- outline -*- do no work. I.e., "sort < big-file | less" could waste a lot of power. [bug introduced in coreutils-8.6] + sort with at least two threads no longer segfaults due to use of pointers + into the stack of an expired thread. [bug introduced in coreutils-8.6] + ** New features split accepts the --number option to generate a specific number of files.