-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Support neighbouring extension in the ZendMM custom handlers hook in zend_test
#12792
Support neighbouring extension in the ZendMM custom handlers hook in zend_test
#12792
Conversation
dd9c57c
to
8eab44f
Compare
8eab44f
to
6d67096
Compare
6d67096
to
4838205
Compare
@bwoebi can I ping you to review this PR? |
int flag = 0; | ||
memcpy(&flag, heap, sizeof(int)); | ||
int new_flag = 0; | ||
memcpy(heap, &new_flag, sizeof(int)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, no.
It works, but we should not do it this way, especially not advertise that in php-src itself.
You probably should include a
#ifndef ZEND_ALLOC_HIDE_STRUCTS
struct _zend_mm_heap {
#if ZEND_MM_CUSTOM
int use_custom_mm_heap;
#endif
}
#endif
to zend_alloc.h, with #define ZEND_ALLOC_HIDE_STRUCTS 1
in zend_alloc.c
and have it public API.
If we rely on such implementation details, it can well just be public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I get the point and the zend_test_prepare_zendmm_for_call()
is super ugly 😉
OTOH I would rather not make the use_custom_mm_heap
flag public just for the sake of this test.
I am about to prepare a PR that would add a gc
and shutdown
custom handler (#13432) that might help solve this.
Closing this in favour of #13432 |
This PR will add support for neighouring extensions in the
zend_mm_set_custom_handlers()
hook, asUSE_ZEND_ALLOC=0
technically installs a custom memory handler in the ZendMM and is used for the ASAN tests.This realtes to #12768 and #12758
As the PHP 8.1 merge window has closed, this targets PHP 8.2