[php-src] master: tests: Raise test stack for stream error depth limit under MSan (#23985)
| From: | Florian Engelhardt via GitHub | Date: | Tue, 29 Sep 2026 14:44:41 +0000 |
| Subject: | [php-src] master: tests: Raise test stack for stream error depth limit under MSan (#23985) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141682@lists.php.net to get a copy of this message | ||
Author: Florian Engelhardt (realFlowControl)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-09-29T15:44:37+01:00
Commit: https://github.com/php/php-src/commit/d2208a22b33920cf68b2b23a5cab7077a917e7e5
Raw diff: https://github.com/php/php-src/commit/d2208a22b33920cf68b2b23a5cab7077a917e7e5.diff
tests: Raise test stack for stream error depth limit under MSan (#23985)
Changed paths:
M ext/standard/tests/streams/stream_errors_operation_depth_limit.phpt
Diff:
diff --git a/ext/standard/tests/streams/stream_errors_operation_depth_limit.phpt
b/ext/standard/tests/streams/stream_errors_operation_depth_limit.phpt
index 1eae9c5fd31d..3c1f934ef30d 100644
--- a/ext/standard/tests/streams/stream_errors_operation_depth_limit.phpt
+++ b/ext/standard/tests/streams/stream_errors_operation_depth_limit.phpt
@@ -2,8 +2,30 @@
Stream errors: operations refused by the depth limit keep the stack consistent
--INI--
zend.max_allowed_stack_size=-1
+--SKIPIF--
+<?php
+if (getenv('SKIP_MSAN')) {
+ if (!function_exists('posix_setrlimit') || !defined('POSIX_RLIMIT_STACK'))
{
+ die('skip MSan needs a larger C stack');
+ }
+ [, $hard] = posix_getrlimit(POSIX_RLIMIT_STACK);
+ if (($hard !== 'unlimited' && $hard < 32 * 1024 * 1024)
+ || !posix_setrlimit(POSIX_RLIMIT_STACK, 32 * 1024 * 1024, $hard === 'unlimited' ?
-1 : $hard)) {
+ die('skip MSan needs a larger C stack');
+ }
+}
+?>
--FILE--
<?php
+// MSan needs more stack to reach the stream error operation limit.
+if (getenv('SKIP_MSAN') && function_exists('posix_setrlimit')
&& defined('POSIX_RLIMIT_STACK')) {
+ [$soft, $hard] = posix_getrlimit(POSIX_RLIMIT_STACK);
+ if ($soft !== 'unlimited' && $soft < 32 * 1024 * 1024
+ && ($hard === 'unlimited' || $hard >= 32 * 1024 * 1024)) {
+ posix_setrlimit(POSIX_RLIMIT_STACK, 32 * 1024 * 1024, $hard === 'unlimited' ? -1
: $hard);
+ }
+}
+
class RecursiveStream
{
public $context;