-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix bug #68571 : core dump when webserver close the socket #948
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
Conversation
|
According to the fastcgi protocol(http://www.fastcgi.com/devkit/doc/fcgi-spec.html), I write a php client to talk with php directly. server code(/home/users/xxx/test/index.php) is here: fastcgi client code is here: |
sapi/fpm/fpm/fpm_main.c
Outdated
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.
break C89 here... move the declaration to the top please.
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.
Yes, I will fix it. thank niaoge
|
已经提交, 感谢你的Fix(Merged thanks) :) |
|
@laruence why not merged into PHP 5.4 branch? |
|
@netroby 5.4 is in only security fix status |
the bug is here: https://bugs.php.net/bug.php?id=68571
There is several conditions when core dump
1 don't use error_log in php.ini.
2 a lot of stderr log generate
3 webserver close the socket after send the request(request timeout will lead the action)
from the code of php, we know that
1 output is base a buffer(out_buf)
2 out_pos point to the last address, out_pos - out_buf <= 8192 (the buffer's length)
3 if out_hdr is NULL, we let out_pos add sizeof(fcgi_header)
4 before write data to client, we will reset out_hdr to NULL(in function close_packet)
but when write stderr to client failed, there are two mistake
1 we don't reset the pos of out_pos
2 we don't check the return value of fcgi_write
so out_pos add more and more sizeof(fcgi_header) until address out of bounds and core dump
I rest the pos of out_pos and check the return value of fcgi_write in my PR