-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Memory corruption on 8.4 #17974
Comments
Curiously, manually extracting the shadow, shadow key and next ptr for slot 8 (should be the correct slot number for the allocation size 231) from the coredump and manually recomputing the next ptr from the shadow+shadowkey returns a correct value... Might have chosen the wrong slot tho |
It would be super useful to have tooling in |
Well, can you reproduce this reliably? Would it possible to disable Redis? Ofc, this could hide the issue even if it isn't caused by Redis. In any case, I really don't know how we can help without a reproducer... |
I can't reproduce this reliably unless I were to try and run ASAN in production, which isn't something I can realistically do (this is a very common condition actually). I did, however, come up with a small gdb script to analyze the zend heap, to pinpoint the exact change causing the assertion: it's a single flipped bit (which makes me think of cosmic rays, if it didn't happen regularly and only if persistent redis connections are enabled).
Resulting in (some manual padding added for readability):
The difference between 0x85 and 0x05 is a single bit... The rest of the page doesn't contain anything I can make sense of either:
|
We are currently also seeing this issue with 8.3.19 with a similar GDB trace with the error happening in |
@smelchior It's more relevant what comes before |
oh yes sorry, in this case i am getting
which indeed looks different ;) I might therefore be mistaken. |
@smelchior Likely unrelated, but who knows. Do you have a reliable way to reproduce this? If you can identify which endpoint caused the crash, you may try to run it with Valgrind (which will be very slow, but might give some insight). |
I do, this happens on a CLI call. From my strace i can see that it dies when parsing a specific XML config file.
For the
for the I am really sorry if this does not quite match the initial issue and i am happy to open another one if that makes more sense. |
@smelchior This does look useful, thank you! /cc @nielsdos Relevant excerpt
|
@iluuu1994 @smelchior The bug you're seeing is definitely different from OP's bug because libxml always uses system malloc, so it can't corrupt ZendMM. |
@iluuu1994 @smelchior Based on the stacktrace I was able to make a guess and a reproducer, and the fix is here (hopefully): #18100 |
Thank you so much @nielsdos for tackling this so quickly! |
The DOM issue is resolved, but this issue needs more information in order to be able to do something. Either a reproducer or an ASAN trace would help. We're not even sure the problem is inside PHP. |
Description
After switching to PHP 8.4, we're seeing memory corruption segfaults occurring during zend_deactivate (no JIT, just opcache).
Not sure whether it's viable to run with ASAN on prod to further debug the issue...
Ref phpredis/phpredis#2630
While redis is in the stack trace, obviously the corruption couuld have happened sooner.
PHP Version
PHP 8.4.4
Operating System
Ubuntu 24.04.1
The text was updated successfully, but these errors were encountered: