From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2B6AA15808A for ; Wed, 23 Jul 2025 17:45:20 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 1643C3415DE for ; Wed, 23 Jul 2025 17:45:20 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 7ACD5110561; Wed, 23 Jul 2025 17:45:13 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 765A3110561 for ; Wed, 23 Jul 2025 17:45:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2BF323410B7 for ; Wed, 23 Jul 2025 17:45:13 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3D998326A for ; Wed, 23 Jul 2025 17:45:11 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1753292674.58e552cfa7592cac2a37bb63e1fac4b0121fb2af.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-parallel/, dev-php/pecl-parallel/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-php/pecl-parallel/files/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch dev-php/pecl-parallel/pecl-parallel-1.2.7-r1.ebuild X-VCS-Directories: dev-php/pecl-parallel/ dev-php/pecl-parallel/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 58e552cfa7592cac2a37bb63e1fac4b0121fb2af X-VCS-Branch: master Date: Wed, 23 Jul 2025 17:45:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 66548fea-b993-440a-bd40-55812fe50e61 X-Archives-Hash: ee6a2f59c5bd8bfb8e2e6f431bf349a3 commit: 58e552cfa7592cac2a37bb63e1fac4b0121fb2af Author: Jaco Kroon uls co za> AuthorDate: Wed Jul 23 14:28:52 2025 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jul 23 17:44:34 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58e552cf dev-php/pecl-parallel: add 1.2.7-r1 See also: https://github.com/krakjoe/parallel/issues/345 https://github.com/krakjoe/parallel/pull/347 Closes: https://bugs.gentoo.org/957101 Signed-off-by: Jaco Kroon uls.co.za> Part-of: https://github.com/gentoo/gentoo/pull/43125 Signed-off-by: Sam James gentoo.org> ...llel-1.2.7-bug933981-crash-due-to-memleak.patch | 58 ++++++++++++++++++++++ .../pecl-parallel/pecl-parallel-1.2.7-r1.ebuild | 23 +++++++++ 2 files changed, 81 insertions(+) diff --git a/dev-php/pecl-parallel/files/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch b/dev-php/pecl-parallel/files/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch new file mode 100644 index 000000000000..c08f8fab3889 --- /dev/null +++ b/dev-php/pecl-parallel/files/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch @@ -0,0 +1,58 @@ +https://bugs.gentoo.org/957101 +https://github.com/krakjoe/parallel/issues/345 +https://github.com/krakjoe/parallel/pull/347 + +This PR fixes a memory leak that caused the cache to exhaust when +running closures with nested functions (dynamic function definitions). + +When scheduling closures containing nested functions, +php_parallel_cache_closure() was allocating memory from the cache pool +for the dynamic_func_defs array. This memory was never properly freed, +causing the cache to fill up and eventually trigger a realloc() that +could lead to segfaults in case the OS decided to move the entire +allocation to a different address. + +From d4fa9a8a490dbdd3caac5f9a0ef384838c078a6f Mon Sep 17 00:00:00 2001 +From: Florian Engelhardt +Date: Wed, 23 Jul 2025 16:19:48 +0200 +Subject: [PATCH] fix cache overflow + +--- + src/cache.c | 5 ++++- + src/scheduler.c | 5 ++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/cache.c b/src/cache.c +index afbfb6d..ed90cc0 100644 +--- a/src/cache.c ++++ b/src/cache.c +@@ -394,7 +394,10 @@ zend_function* php_parallel_cache_closure(const zend_function *source, zend_func + #if PHP_VERSION_ID >= 80100 + if (source->op_array.num_dynamic_func_defs) { + uint32_t it = 0; +- closure->op_array.dynamic_func_defs = php_parallel_cache_copy_mem( ++ /* Use regular persistent memory for dynamic_func_defs array, not cache pool */ ++ closure->op_array.dynamic_func_defs = pemalloc( ++ sizeof(zend_op_array*) * source->op_array.num_dynamic_func_defs, 1); ++ memcpy(closure->op_array.dynamic_func_defs, + source->op_array.dynamic_func_defs, + sizeof(zend_op_array*) * source->op_array.num_dynamic_func_defs); + while (it < source->op_array.num_dynamic_func_defs) { +diff --git a/src/scheduler.c b/src/scheduler.c +index 1f92bfa..8820e96 100644 +--- a/src/scheduler.c ++++ b/src/scheduler.c +@@ -258,9 +258,12 @@ static void php_parallel_scheduler_clean(zend_function *function) { + while (it < function->op_array.num_dynamic_func_defs) { + php_parallel_scheduler_clean( + (zend_function*) function->op_array.dynamic_func_defs[it]); +- pefree(function->op_array.dynamic_func_defs[it],1); ++ pefree(function->op_array.dynamic_func_defs[it], 1); + it++; + } ++ /* Free the dynamic_func_defs array itself */ ++ pefree(function->op_array.dynamic_func_defs, 1); ++ function->op_array.dynamic_func_defs = NULL; + } + #endif + } diff --git a/dev-php/pecl-parallel/pecl-parallel-1.2.7-r1.ebuild b/dev-php/pecl-parallel/pecl-parallel-1.2.7-r1.ebuild new file mode 100644 index 000000000000..d1ce4a21c82e --- /dev/null +++ b/dev-php/pecl-parallel/pecl-parallel-1.2.7-r1.ebuild @@ -0,0 +1,23 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" + +PHP_EXT_INI="yes" +PHP_EXT_NAME="parallel" +PHP_EXT_NEEDED_USE="threads" +PHP_EXT_ZENDEXT="no" +USE_PHP="php8-2 php8-3" + +inherit php-ext-pecl-r3 + +DESCRIPTION="A succint parallel concurrency API for PHP" +SRC_URI="${SRC_URI} -> ${P}.tgz" + +PATCHES=( + "${FILESDIR}/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch" +) + +LICENSE="PHP-3.01" +SLOT="8" +KEYWORDS="~amd64 ~x86"