Skip to content

Add zend_alloc XLEAK support #10999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,10 @@ void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent)

#if ZEND_DEBUG
if (!silent) {
zend_mm_check_leaks(heap);
char *tmp = getenv("ZEND_ALLOC_PRINT_LEAKS");
if (!tmp || ZEND_ATOL(tmp)) {
zend_mm_check_leaks(heap);
}
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion ext/gettext/tests/bug53251.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bug #53251 (bindtextdomain with null dir doesn't return old value)
gettext
--SKIPIF--
<?php
if (getenv('SKIP_REPEAT')) die('skip gettext leaks global state across requests');
if (getenv('SKIP_REPEAT')) die('xleak gettext leaks global state across requests');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leaking here doesn't refer to memory, so this should be reverted.

?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/pcntl/tests/bug81577_3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bug #81577: (Exceptions in interrupt handlers: cleanup_live_vars)
--EXTENSIONS--
pcntl
posix
--XFAIL--
--XLEAK--
leaks are not fixed yet
--FILE--
<?php
Expand Down
11 changes: 7 additions & 4 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2464,8 +2464,11 @@ function run_test(string $php, $file, array $env): string
$cmd = $valgrind->wrapCommand($cmd, $memcheck_filename, strpos($test_file, "pcre") !== false);
}

if ($test->hasSection('XLEAK') && isset($env['SKIP_ASAN'])) {
$env['LSAN_OPTIONS'] = 'detect_leaks=0';
if ($test->hasSection('XLEAK')) {
$env['ZEND_ALLOC_PRINT_LEAKS'] = '0';
if (isset($env['SKIP_ASAN'])) {
$env['LSAN_OPTIONS'] = 'detect_leaks=0';
}
}

if ($DETAILED) {
Expand Down Expand Up @@ -2664,7 +2667,7 @@ function run_test(string $php, $file, array $env): string
if ($test->hasSection('XFAIL')) {
$warn = true;
$info = " (warn: XFAIL section but test passes)";
} elseif ($test->hasSection('XLEAK') && !isset($env['SKIP_ASAN'])) {
} elseif ($test->hasSection('XLEAK') && $valgrind) {
// XLEAK with ASAN completely disables LSAN so the test is expected to pass
$warn = true;
$info = " (warn: XLEAK section but test passes)";
Expand Down Expand Up @@ -2702,7 +2705,7 @@ function run_test(string $php, $file, array $env): string
if ($test->hasSection('XFAIL')) {
$restype[] = 'XFAIL';
$info = ' XFAIL REASON: ' . rtrim($test->getSection('XFAIL'));
} elseif ($test->hasSection('XLEAK') && !isset($env['SKIP_ASAN'])) {
} elseif ($test->hasSection('XLEAK') && $valgrind) {
// XLEAK with ASAN completely disables LSAN so the test is expected to pass
$restype[] = 'XLEAK';
$info = ' XLEAK REASON: ' . rtrim($test->getSection('XLEAK'));
Expand Down