From patchwork Thu Mar 27 15:30:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 876559 Delivered-To: patch@linaro.org Received: by 2002:a5d:6dae:0:b0:38f:210b:807b with SMTP id u14csp92156wrs; Thu, 27 Mar 2025 08:32:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0YMF8xjHt889UzXHZfkL/Nazvzn0rXgjmlP2tdOjUF9M7xciHt2YnLosmwWOYPH5c7Q7STQ==@linaro.org X-Google-Smtp-Source: AGHT+IFGSANcWOdlWNp1PxNdLScDDVoP9Zf8aAAlDlBbube8cqRXwuvwz+6+QMz58t1q4NUWjnBi X-Received: by 2002:a05:6102:2912:b0:4c4:f128:3abb with SMTP id ada2fe7eead31-4c58709da2amr4020512137.25.1743089529925; Thu, 27 Mar 2025 08:32:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1743089529; cv=pass; d=google.com; s=arc-20240605; b=iirojbFgndTMlru0oXT9QGA7pr8yeZ5NFWOuDSssDaxr2rdVm/V/dAf1igVapV8ZqM VMxIBbiLK2p88wpLYr3LMy6VEuRPUe3tKT5vNOwfu/VNBWi2N1x9tevy/9dAe2XWqjdD Xl/Qgq/xAmTfd5r4NIHQa9XS71U0FiPmncW2+rSgyfDy+jQRD6DaQwWswSlMjM7vzQ1Z 7nu7+ReYAyUBX05y7XCYewlix9pxnBRQ7rs1H0v7RuTXKI2CEEiZbh4k9kCkRv0RVxl/ mItW/9cEJjk70fQ/9z2G9G84iKnuMRgkovi/8z32MBYO7TqurR0dKwZg8f7y05gZ+t64 ZHlg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter:arc-filter:dmarc-filter:delivered-to:dkim-filter; bh=b3VhbMF3IF0Csa86Nh2F1KO30qsYIzhR9EadUhe2lAw=; fh=oOmFpi5VEBZNwQ9TWUXab7uaRTw5F86zdDbZ7wIYJyA=; b=bpqE+MzejPvUn0ekJ6zZdu8LfhG0ohyj0sla1maNLFsUpINYgt65mQS7gd65DIXEyp HplR4EgW9gGb90/66S7JIkM7IlJsfLRoCLSeCQISbbbshfopKAi/KuxueWlBaBOlP8V4 TRXQqr+dzjBKGBOdUhGXeyMRgRshKWy3OouqX31wBJOlUOI7Rz2KZqA2Y4iLeI6/vU1z YLpL69h8nBtMyXwsBtOOorsljiOTgRNkcbgGbkfQ77X+/nexyGUUOk7Ahz0UOgRIBCJV 5zSwk9Wafuyhdw8d36aJ4PHZltmLNVAy35/ET2HmK4Ls2RXYCE5dVkQWc0lBfTtC/k06 7Q4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hJ27nMdJ; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a1e0cc1a2514c-86f9f3ea381si3310074241.67.2025.03.27.08.32.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Mar 2025 08:32:09 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hJ27nMdJ; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 737023857C7F for ; Thu, 27 Mar 2025 15:32:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 737023857C7F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=hJ27nMdJ X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 33E0A3858280 for ; Thu, 27 Mar 2025 15:31:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 33E0A3858280 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 33E0A3858280 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743089478; cv=none; b=XWuGYTMRIP8vtgEUFiTVzCmy0fd2pCXp2500bal0eVGTUQPxBUZX30wUx6niHqFGUaddre7A5yj/PDmg6RohURA3IWzJD8vBu+dYbbzQnE0Sx5HctSzha4YnbflN4ZM0Lx/wP+LjtO/0BHOpvZenF7QAzC3wbrYBkWc9v2DmbSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743089478; c=relaxed/simple; bh=h/qgrdCfGULUQpKoQXWxXfuwXINTnBov3lQf+N0Bjbs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GxZ3t/d/l6aCwLBZhm0NH7rejeEiBPuUXYLPETdyakF25kqTWzUlpgd0xtjCUHB+JBZCvtmSjbD0Oo9evvPe3dopux7LcikkaUClKPw/lV+LOj7mPG74MijULbOjbJ0ZKSM/ur49OnpRjPbASdVdHoEWZEWfm+9dm37o2aIDIWw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33E0A3858280 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-22403cbb47fso26717275ad.0 for ; Thu, 27 Mar 2025 08:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743089472; x=1743694272; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b3VhbMF3IF0Csa86Nh2F1KO30qsYIzhR9EadUhe2lAw=; b=hJ27nMdJVNzlRGvTnI2gyrtRUoChF3PDJtMtMLZmjXukJzpLGRJEcdxu3g0ft7E1r7 63W1Ai+8/b/Mpg49m1E9eAGC6hnxZKhk80t0VplxIZDTXNw7WjUFCtCgZ3M/Gkgki/2s 7mIkgmzagTTeurXKM5lq1QT6K2DwFKkAvYlT5yiqBZSaQWUQuX5GLwEsOB9GrxNtNtPa Zo04p8QeHVZTY4cFQUg50VMaqbEGp+mSZKgRdBuo/Ng+gT79QhyXSxK0jKpq1CTd0IKu WN9liHLZgbz+q95xcuARx/gp3vXe5dfRJrRiNVD1CAI3aGBor33XMFKIi6Wq1ZZzU4Oi jKzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743089472; x=1743694272; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b3VhbMF3IF0Csa86Nh2F1KO30qsYIzhR9EadUhe2lAw=; b=j/CNpV0tPPE4AF1hd8pZPWaAHUIrI+/AEUpF065TJYMEyRe3INPwhWUq5G2gOuy8fG 84aVuCVhGXJJLtHcTGOkTKXuuY5+l6/yKY50zAHbKIXb18mahW75dbKfKbFIqAdC/7fk b/nVEhhErgkjv+d7/goSnbZ9amp7CPR1m/e576FS86sE5Rx9WXRME0zX24qm4qR+C3AG ubIGVey019BO6wwu7JR1yP2R9o2x1IX4JdPEm3W2rKj6dIFNLg3x2t3/ZPbeK/ov+g0a 7+N+JN7+nmuqLEB0pYGBzKvLumdiZjt+gDjPNfM+Bn5qBZcbpAh9zUbgSDxRW08gs/sB xskA== X-Gm-Message-State: AOJu0YyoYKK6WDOkU4CEagEARqwsYtY2gsAoGpx1YBi3g8AA/jE408Jb 0dsXU1H99k7RkKQ0OsT8nCcSFiHJGQ8cAyVIZRNRucBqvEYGGY7XS8Uj+mmmMzmyFitF6tZ26ig i X-Gm-Gg: ASbGncvbr5oRxFTgySzzBnqX1tszC0wgvaEehCYeYD0Z62rr6eb7k8tWESgSjV6GEXZ I5aPdqR7ixssnJwobl5axNCIVj9ikhRJcBPrSe7qR2PPfG9WgX+++km4v7Hez17Hw7FQJbayrKR tGviPNg6UWnpYjr2ps5gyNkynB8YJLWDeiFccrncRe56pgDaO34WhDQZkUEXpNrmZKG6fZT0+WG 3JfDmc+gkUHE4t4S3nRaN6GPqiFCRWN/PFdz1q8PpOXtrrTOJPMdJmsC7Yctv1KKKmCPGknN3bo PnQJoyrUf9Xgcs687H+TmgtY63RJTNdvF1Mp+Cbsl2NgvvfWpag1xe/oTDiXrD0H5s09 X-Received: by 2002:a05:6a00:3d02:b0:736:532b:7c10 with SMTP id d2e1a72fcca58-739610c1aafmr5086524b3a.21.1743089471560; Thu, 27 Mar 2025 08:31:11 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:348b:45ca:56d5:ae1a:bc2b]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73905fa92d4sm14435605b3a.23.2025.03.27.08.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Mar 2025 08:31:11 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Florian Weimer , =?utf-8?b?TMOpbsOhcmQgU3pvbG5va2k=?= Subject: [PATCH v4] stdlib: Fix qsort memory leak if callback throws (BZ 32058) Date: Thu, 27 Mar 2025 12:30:48 -0300 Message-ID: <20250327153107.941398-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org If the input buffer exceeds the stack auxiliary buffer, qsort will malloc a temporary one to call mergesort. Since C++ standard does allow the callback comparison function to throw [1], the glibc implementation can potentially leak memory. The fixes uses a pthread_cleanup_combined_push and pthread_cleanup_combined_pop, so it can work with and without exception enables. The qsort code path that calls malloc now requires some extra setup and a call to __pthread_cleanup_push anmd __pthread_cleanup_pop (which should be ok since they just setup some buffer state). Checked on x86_64-linux-gnu. [1] https://timsong-cpp.github.io/cppwp/n4950/alg.c.library#4 --- stdlib/Makefile | 32 ++++++++++++++- stdlib/qsort.c | 81 +++++++++++++++++++++++--------------- stdlib/tst-qsort4.c | 4 ++ stdlib/tst-qsort7.c | 81 ++++++++++++++++++++++++++++++++++++++ stdlib/tst-qsortx7.c | 1 + sysdeps/htl/pthreadP.h | 15 +++++++ sysdeps/mach/hurd/Makefile | 3 ++ sysdeps/nptl/pthreadP.h | 8 ++-- 8 files changed, 189 insertions(+), 36 deletions(-) create mode 100644 stdlib/tst-qsort7.c create mode 100644 stdlib/tst-qsortx7.c diff --git a/stdlib/Makefile b/stdlib/Makefile index c9c8f702a2..513445bcbc 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -300,6 +300,8 @@ tests := \ tst-qsort2 \ tst-qsort3 \ tst-qsort6 \ + tst-qsort7 \ + tst-qsortx7 \ tst-quick_exit \ tst-rand-sequence \ tst-rand48 \ @@ -553,7 +555,19 @@ tests-special += $(objpfx)isomac.out ifeq ($(run-built-tests),yes) tests-special += $(objpfx)tst-fmtmsg.out -endif +ifeq ($(build-shared),yes) +ifneq ($(PERL),no) +generated += \ + tst-qsort7.mtrace \ + tst-qsortx7.mtrace \ + # generated +tests-special += \ + $(objpfx)tst-qsort7-mem.out \ + $(objpfx)tst-qsortx7-mem.out \ + # tests-special +endif # $(build-shared) == yes +endif # $(PERL) == yes +endif # $(run-built-tests) == yes include ../Rules @@ -647,3 +661,19 @@ $(objpfx)tst-getrandom2: $(shared-thread-library) $(objpfx)tst-getenv-signal: $(shared-thread-library) $(objpfx)tst-getenv-thread: $(shared-thread-library) $(objpfx)tst-getenv-unsetenv: $(shared-thread-library) + +CFLAGS-tst-qsort7.c += -fno-exceptions -fno-asynchronous-unwind-tables +LDLIBS-tst-qsort7 = $(shared-thread-library) +tst-qsort7-ENV = MALLOC_TRACE=$(objpfx)tst-qsort7.mtrace \ + LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so +$(objpfx)tst-qsort7-mem.out: $(objpfx)tst-qsort7.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-qsort7.mtrace > $@; \ + $(evaluate-test) + +CFLAGS-tst-qsortx7.c += -fexceptions +LDLIBS-tst-qsortx7 = $(shared-thread-library) +tst-qsortx7-ENV = MALLOC_TRACE=$(objpfx)tst-qsortx7.mtrace \ + LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so +$(objpfx)tst-qsortx7-mem.out: $(objpfx)tst-qsortx7.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-qsortx7.mtrace > $@; \ + $(evaluate-test) diff --git a/stdlib/qsort.c b/stdlib/qsort.c index 08fdb84541..0b1e0e97d6 100644 --- a/stdlib/qsort.c +++ b/stdlib/qsort.c @@ -25,6 +25,7 @@ #include #include #include +#include "pthreadP.h" /* Swap SIZE bytes between addresses A and B. These helpers are provided along the generic one as an optimization. */ @@ -338,36 +339,10 @@ indirect_msort_with_tmp (const struct msort_param *p, void *b, size_t n, } } -void -__qsort_r (void *const pbase, size_t total_elems, size_t size, - __compar_d_fn_t cmp, void *arg) +static void +qsort_r_mergesort (void *const pbase, size_t total_elems, size_t size, + __compar_d_fn_t cmp, void *arg, void *buf) { - if (total_elems <= 1) - return; - - /* Align to the maximum size used by the swap optimization. */ - _Alignas (uint64_t) char tmp[QSORT_STACK_SIZE]; - size_t total_size = total_elems * size; - char *buf; - - if (size > INDIRECT_SORT_SIZE_THRES) - total_size = 2 * total_elems * sizeof (void *) + size; - - if (total_size <= sizeof tmp) - buf = tmp; - else - { - int save = errno; - buf = malloc (total_size); - __set_errno (save); - if (buf == NULL) - { - /* Fallback to heapsort in case of memory failure. */ - heapsort_r (pbase, total_elems - 1, size, cmp, arg); - return; - } - } - if (size > INDIRECT_SORT_SIZE_THRES) { const struct msort_param msort_param = @@ -392,9 +367,53 @@ __qsort_r (void *const pbase, size_t total_elems, size_t size, }; msort_with_tmp (&msort_param, pbase, total_elems); } +} - if (buf != tmp) - free (buf); +static bool +qsort_r_malloc (void *const pbase, size_t total_elems, size_t size, + __compar_d_fn_t cmp, void *arg, size_t total_size) +{ + int save = errno; + char *buf = malloc (total_size); + __set_errno (save); + if (buf == NULL) + return false; + + /* Deallocate the auxiliary buffer if the callback function throws + or if the thread is cancelled. */ + pthread_cleanup_combined_push (free, buf); + qsort_r_mergesort (pbase, total_elems, size, cmp, arg, buf); + pthread_cleanup_combined_pop (0); + + free (buf); + + return true; +} + +void +__qsort_r (void *const pbase, size_t total_elems, size_t size, + __compar_d_fn_t cmp, void *arg) +{ + if (total_elems <= 1) + return; + + /* Align to the maximum size used by the swap optimization. */ + size_t total_size = total_elems * size; + + if (size > INDIRECT_SORT_SIZE_THRES) + total_size = 2 * total_elems * sizeof (void *) + size; + + if (total_size <= QSORT_STACK_SIZE) + { + _Alignas (uint64_t) char tmp[QSORT_STACK_SIZE]; + qsort_r_mergesort (pbase, total_elems, size, cmp, arg, tmp); + } + else + { + if (!qsort_r_malloc (pbase, total_elems, size, cmp, arg, total_size)) + /* Fallback to heapsort in case of memory failure. */ + heapsort_r (pbase, total_elems - 1, size, cmp, arg); + } } libc_hidden_def (__qsort_r) weak_alias (__qsort_r, qsort_r) diff --git a/stdlib/tst-qsort4.c b/stdlib/tst-qsort4.c index 2875d40eb7..a36e66a697 100644 --- a/stdlib/tst-qsort4.c +++ b/stdlib/tst-qsort4.c @@ -16,6 +16,10 @@ License along with the GNU C Library; if not, see . */ +#undef pthread_cleanup_combined_push +#define pthread_cleanup_combined_push(routine, arg) +#undef pthread_cleanup_combined_pop +#define pthread_cleanup_combined_pop(execute) #include "qsort.c" #include diff --git a/stdlib/tst-qsort7.c b/stdlib/tst-qsort7.c new file mode 100644 index 0000000000..ba0c3d7387 --- /dev/null +++ b/stdlib/tst-qsort7.c @@ -0,0 +1,81 @@ +/* Test if qsort cleanup memory allocation if the comparison function + throws (BZ 32058) + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include + +static pthread_barrier_t b; + +static void +cl (void *arg) +{ +} + +static int +compar_func (const void *a1, const void *a2) +{ + xpthread_barrier_wait (&b); + + pthread_cleanup_push (cl, NULL); + + pause (); + + pthread_cleanup_pop (0); + + support_record_failure (); + + return 0; +} + +static void * +tf (void *tf) +{ + /* An array larger than QSORT_STACK_SIZE to force memory allocation. */ + int input[1024] = { 0 }; + qsort (input, array_length (input), sizeof input[0], compar_func); + + return NULL; +} + +static int +do_test (void) +{ + mtrace (); + + xpthread_barrier_init (&b, NULL, 2); + + pthread_t thr = xpthread_create (NULL, tf, NULL); + + xpthread_barrier_wait (&b); + + xpthread_cancel (thr); + + { + void *r = xpthread_join (thr); + TEST_VERIFY (r == PTHREAD_CANCELED); + } + + return 0; +} + +#include diff --git a/stdlib/tst-qsortx7.c b/stdlib/tst-qsortx7.c new file mode 100644 index 0000000000..ab6152320c --- /dev/null +++ b/stdlib/tst-qsortx7.c @@ -0,0 +1 @@ +#include "tst-qsort7.c" diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 78ef4e7674..535deeb89f 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -23,6 +23,7 @@ #include #include +#include /* Attribute to indicate thread creation was issued from C11 thrd_create. */ #define ATTR_C11_THREAD ((void*)(uintptr_t)-1) @@ -233,4 +234,18 @@ weak_extern (__pthread_exit) _Static_assert (sizeof (type) == size, \ "sizeof (" #type ") != " #size) + /* Special cleanup macros which register cleanup both using + __pthread_cleanup_{push,pop} and using cleanup attribute. This is needed + for qsort, so that it supports both throwing exceptions from the caller + sort function callback (only cleanup attribute works there) and + cancellation of the thread running the callback if the callback or some + routines it calls don't have unwind information. + TODO: add support for cleanup routines. */ +#ifndef pthread_cleanup_combined_push +# define pthread_cleanup_combined_push __pthread_cleanup_push +#endif +#ifndef pthread_cleanup_combined_pop +# define pthread_cleanup_combined_pop __pthread_cleanup_pop +#endif + #endif /* pthreadP.h */ diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 4b69b40065..994de00e2f 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -337,6 +337,9 @@ tests-unsupported += tst-vfprintf-width-prec-alloc endif ifeq ($(subdir),stdlib) tests-unsupported += test-bz22786 tst-strtod-overflow +# pthread_cleanup_combined_push/pthread_cleanup_combined_pop requires cleanup +# support (BZ 32058). +test-xfail-tst-qsortx7 = yes endif ifeq ($(subdir),timezone) tests-unsupported += tst-tzset diff --git a/sysdeps/nptl/pthreadP.h b/sysdeps/nptl/pthreadP.h index 2d620ed20d..8f256967e2 100644 --- a/sysdeps/nptl/pthreadP.h +++ b/sysdeps/nptl/pthreadP.h @@ -588,10 +588,10 @@ struct __pthread_cleanup_combined_frame /* Special cleanup macros which register cleanup both using __pthread_cleanup_{push,pop} and using cleanup attribute. This is needed - for pthread_once, so that it supports both throwing exceptions from the - pthread_once callback (only cleanup attribute works there) and cancellation - of the thread running the callback if the callback or some routines it - calls don't have unwind information. */ + for pthread_once and qsort, so that it supports both throwing exceptions + from the pthread_once or caller sort function callback (only cleanup + attribute works there) and cancellation of the thread running the callback + if the callback or some routines it calls don't have unwind information. */ static __always_inline void __pthread_cleanup_combined_routine (struct __pthread_cleanup_combined_frame