-
Notifications
You must be signed in to change notification settings - Fork 7.8k
PHPDBG ASAN failures under tracked alloc without zend alloc #11053
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
Comments
It also fails on 8.2, we've been aware about this in a while and have been monkey patching |
I don't think that's the same issue. I've fixed that issue here and it was PHP-8.2+ only. This here sounds like some |
Oh I forgot, indeed! |
So the problem might actually be me after all. At the top of the test file I see: In any case, feel free to close if these shouldn't be fixed |
Well, it segfaults without ASAN. ASAN catches the memory errors before it gets a chance to crash. The |
Yes it was missing. |
Oh, I see what you mean now. There seem to be quite a few leaks that are not reported with ZMM for some reason. I managed to find a few but there are still more. diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index d6457ef805..1f19b76bde 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.c
@@ -157,6 +157,8 @@ PHPDBG_INFO(constants) /* {{{ */
} ZEND_HASH_FOREACH_END();
}
+ zend_hash_destroy(&consts);
+
return SUCCESS;
} /* }}} */
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index f8041c660f..db50613dbc 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -880,6 +880,7 @@ PHPDBG_COMMAND(run) /* {{{ */
PHPDBG_G(flags) ^= PHPDBG_IS_INTERACTIVE;
PHPDBG_G(flags) |= PHPDBG_IS_RUNNING;
zend_execute(PHPDBG_G(ops), &PHPDBG_G(retval));
+ zval_ptr_dtor(&PHPDBG_G(retval));
PHPDBG_G(flags) ^= PHPDBG_IS_INTERACTIVE;
} zend_catch {
PHPDBG_G(in_execution) = 0;
@@ -1547,6 +1548,9 @@ int phpdbg_interactive(bool allow_async_unsafe, char *input) /* {{{ */
ret = phpdbg_stack_execute(&stack, allow_async_unsafe);
} zend_catch {
phpdbg_stack_free(&stack);
+ if (input) {
+ phpdbg_destroy_input(&input);
+ }
zend_bailout();
} zend_end_try(); |
Oh, and tracked alloc doesn't seem to work at all, there's some issue with restoring the custom handlers, as phpdbg overrides them itself. |
Description
The following tests fail with USE_TRACKED_ALLOC=1 and USE_ZEND_ALLOC=0 under ASAN:
Some fail with:
Zend/zend_alloc.c:2806: tracked_get_size_zv: Assertion
size_zv && "Trying to free pointer not allocated through ZendMM"' failed.`and some fail with a use-after-free message
PHP Version
current master, stable versions not tested
Operating System
Linux 6.2.10
The text was updated successfully, but these errors were encountered: