Skip to content

Instantly share code, notes, and snippets.

@ekinhbayar
Last active May 27, 2017 14:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ekinhbayar/409229701ed30befe94c8d5c86b66806 to your computer and use it in GitHub Desktop.
(gdb) run -d opcache.protect_memory=1 -d opcache.enable_file_override=1 -dopcache.validate_timestamps=1 -d opcache.file_update_protection=0 -d opcache.revalidate_freq=0 test.php
Starting program: /usr/local/bin/php713 -d opcache.protect_memory=1 -d opcache.enable_file_override=1 -dopcache.validate_timestamps=1 -d opcache.file_update_protection=0 -d opcache.revalidate_freq=0 test.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00007fffed937f70 in validate_timestamp_and_record (persistent_script=0x7fffe53924c0, file_handle=0x7fffffffa870) at /opt/php-src/ext/opcache/ZendAccelerator.c:958
958 persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq;
(gdb) bt
#0 0x00007fffed937f70 in validate_timestamp_and_record (persistent_script=0x7fffe53924c0, file_handle=0x7fffffffa870) at /opt/php-src/ext/opcache/ZendAccelerator.c:958
#1 0x00007fffed941edf in filename_is_in_cache (filename=0x7fffe5392250) at /opt/php-src/ext/opcache/zend_accelerator_module.c:345
#2 0x00007fffed941f7c in accel_file_in_cache (execute_data=0x7fffee0130f0, return_value=0x7fffee013080) at /opt/php-src/ext/opcache/zend_accelerator_module.c:365
#3 0x00007fffed942002 in accel_is_file (execute_data=0x7fffee0130f0, return_value=0x7fffee013080) at /opt/php-src/ext/opcache/zend_accelerator_module.c:379
#4 0x0000000000c207bb in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER () at /opt/php-src/Zend/zend_vm_execute.h:675
#5 0x0000000000c1fae8 in execute_ex (ex=0x7fffee013030) at /opt/php-src/Zend/zend_vm_execute.h:429
#6 0x0000000000c1fce9 in zend_execute (op_array=0x7fffee082000, return_value=0x0) at /opt/php-src/Zend/zend_vm_execute.h:474
#7 0x0000000000bb1bd4 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /opt/php-src/Zend/zend.c:1476
#8 0x0000000000ae9718 in php_execute_script (primary_file=0x7fffffffd060) at /opt/php-src/main/main.c:2537
#9 0x0000000000caf9f4 in do_cli (argc=11, argv=0x166f4a0) at /opt/php-src/sapi/cli/php_cli.c:993
#10 0x0000000000cb0e9c in main (argc=11, argv=0x166f4a0) at /opt/php-src/sapi/cli/php_cli.c:1381
(gdb)
(gdb)
(gdb) bt full
#0 0x00007fffed937f70 in validate_timestamp_and_record (persistent_script=0x7fffe53924c0, file_handle=0x7fffffffa870) at /opt/php-src/ext/opcache/ZendAccelerator.c:958
No locals.
#1 0x00007fffed941edf in filename_is_in_cache (filename=0x7fffe5392250) at /opt/php-src/ext/opcache/zend_accelerator_module.c:345
handle = {handle = {fd = 0, fp = 0x0, stream = {handle = 0x0, isatty = 0, mmap = {len = 0, pos = 0, map = 0x0, buf = 0x0, old_handle = 0x0, old_closer = 0x0}, reader = 0x0,
fsizer = 0x0, closer = 0x0}}, filename = 0x7fffe5392268 "/home/ekinhb/PhpstormProjects/php-src/bug.php", opened_path = 0x0, type = ZEND_HANDLE_FILENAME,
free_filename = 0 '\000'}
persistent_script = 0x7fffe53924c0
key = 0x7fffe5392268 "/home/ekinhb/PhpstormProjects/php-src/bug.php"
key_length = 45
#2 0x00007fffed941f7c in accel_file_in_cache (execute_data=0x7fffee0130f0, return_value=0x7fffee013080) at /opt/php-src/ext/opcache/zend_accelerator_module.c:365
zfilename = {value = {lval = 140737039114832, dval = 6.9533336124054249e-310, counted = 0x7fffe5392250, str = 0x7fffe5392250, arr = 0x7fffe5392250, obj = 0x7fffe5392250,
res = 0x7fffe5392250, ref = 0x7fffe5392250, ast = 0x7fffe5392250, zv = 0x7fffe5392250, ptr = 0x7fffe5392250, ce = 0x7fffe5392250, func = 0x7fffe5392250, ww = {
w1 = 3845726800, w2 = 32767}}, u1 = {v = {type = 6 '\006', type_flags = 0 '\000', const_flags = 0 '\000', reserved = 0 '\000'}, type_info = 6}, u2 = {next = 0,
cache_slot = 0, lineno = 0, num_args = 0, fe_pos = 0, fe_iter_idx = 0, access_flags = 0, property_guard = 0, extra = 0}}
#3 0x00007fffed942002 in accel_is_file (execute_data=0x7fffee0130f0, return_value=0x7fffee013080) at /opt/php-src/ext/opcache/zend_accelerator_module.c:379
No locals.
#4 0x0000000000c207bb in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER () at /opt/php-src/Zend/zend_vm_execute.h:675
call = 0x7fffee0130f0
fbc = 0x1925890
ret = 0x7fffee013080
retval = {value = {lval = 140737186443584, dval = 6.9533408914129257e-310, counted = 0x7fffee013140, str = 0x7fffee013140, arr = 0x7fffee013140, obj = 0x7fffee013140,
res = 0x7fffee013140, ref = 0x7fffee013140, ast = 0x7fffee013140, zv = 0x7fffee013140, ptr = 0x7fffee013140, ce = 0x7fffee013140, func = 0x7fffee013140, ww = {
w1 = 3993055552, w2 = 32767}}, u1 = {v = {type = 64 '@', type_flags = 49 '1', const_flags = 1 '\001', reserved = 238 '\356'}, type_info = 3993055552}, u2 = {next = 32767,
cache_slot = 32767, lineno = 32767, num_args = 32767, fe_pos = 32767, fe_iter_idx = 32767, access_flags = 32767, property_guard = 32767, extra = 32767}}
__PRETTY_FUNCTION__ = "ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER"
#5 0x0000000000c1fae8 in execute_ex (ex=0x7fffee013030) at /opt/php-src/Zend/zend_vm_execute.h:429
orig_opline = 0x0
orig_execute_data = 0x0
#6 0x0000000000c1fce9 in zend_execute (op_array=0x7fffee082000, return_value=0x0) at /opt/php-src/Zend/zend_vm_execute.h:474
execute_data = 0x7fffee013030
#7 0x0000000000bb1bd4 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /opt/php-src/Zend/zend.c:1476
files = <error reading variable files (Attempt to dereference a generic pointer.)>
i = 1
file_handle = 0x7fffffffd060
op_array = 0x7fffee082000
#8 0x0000000000ae9718 in php_execute_script (primary_file=0x7fffffffd060) at /opt/php-src/main/main.c:2537
realfile = "/home/ekinhb/PhpstormProjects/php-src/test.php", '\000' <repeats 98 times>, "\320xh\001\000\000\000\000\006\024\000\000\000\000\000\000\000\273h\001\000\000\000\000\006\024\000\000\000\000\000\000\320xh\001\000\000\000\000\006\024\000\000\000\000\000\000\260\266h\001\000\000\000\000"...
__orig_bailout = 0x7fffffffd0d0
__bailout = {{__jmpbuf = {16, 9027779417070059988, 4477888, 140737488348160, 0, 0, 9027779418311573972, -9027778612829535788}, __mask_was_saved = 0, __saved_mask = {__val = {
140737186369616, 140737488338208, 11980296, 0, 0, 0, 0, 19401464, 34359739883, 72, 140737186365504, 140737186369616, 38352715840, 140737186369616, 140737186365504,
140737186369664}}}}
prepend_file_p = 0x0
append_file_p = 0x0
prepend_file = {handle = {fd = 0, fp = 0x0, stream = {handle = 0x0, isatty = 0, mmap = {len = 0, pos = 0, map = 0x0, buf = 0x0, old_handle = 0x0, old_closer = 0x0},
reader = 0x0, fsizer = 0x0, closer = 0x0}}, filename = 0x0, opened_path = 0x0, type = ZEND_HANDLE_FILENAME, free_filename = 0 '\000'}
append_file = {handle = {fd = 0, fp = 0x0, stream = {handle = 0x0, isatty = 0, mmap = {len = 0, pos = 0, map = 0x0, buf = 0x0, old_handle = 0x0, old_closer = 0x0},
reader = 0x0, fsizer = 0x0, closer = 0x0}}, filename = 0x0, opened_path = 0x0, type = ZEND_HANDLE_FILENAME, free_filename = 0 '\000'}
old_cwd = 0x7fffffffab40 ""
use_heap = 0 '\000'
retval = 0
#9 0x0000000000caf9f4 in do_cli (argc=11, argv=0x166f4a0) at /opt/php-src/sapi/cli/php_cli.c:993
__orig_bailout = 0x7fffffffe240
__bailout = {{__jmpbuf = {23524960, 9027779415945986516, 4477888, 140737488348160, 0, 0, 9027779417072157140, -9027777825202028076}, __mask_was_saved = 0, __saved_mask = {
__val = {24190432, 90194313237, 23084928, 4611686018427388041, 140737488345920, 77309411346, 0, 12884901891, 0, 0, 139637976727552, 140737488342784, 25, 4294954720, 0,
0}}}}
c = -1
file_handle = {handle = {fd = -301498352, fp = 0x7fffee078010, stream = {handle = 0x7fffee078010, isatty = 0, mmap = {len = 176, pos = 0, map = 0x7ffff7fe5000,
buf = 0x7ffff7fe5000 <error: Cannot access memory at address 0x7ffff7fe5000>, old_handle = 0x19592b0, old_closer = 0xbdd633 <zend_stream_stdio_closer>},
reader = 0xbdd604 <zend_stream_stdio_reader>, fsizer = 0xbdd665 <zend_stream_stdio_fsizer>, closer = 0xbdd7a0 <zend_stream_mmap_closer>}},
filename = 0x163fa40 "test.php", opened_path = 0x0, type = ZEND_HANDLE_MAPPED, free_filename = 0 '\000'}
behavior = 1
reflection_what = 0x0
request_started = 1
exit_status = 0
php_optarg = 0x166f5d0 "opcache.revalidate_freq=0"
orig_optarg = 0x0
php_optind = 11
orig_optind = 1
exec_direct = 0x0
exec_run = 0x0
exec_begin = 0x0
exec_end = 0x0
arg_free = 0x163fa40 "test.php"
arg_excp = 0x166f4f0
script_file = 0x163fa40 "test.php"
translated_path = 0x195a6d0 "/home/ekinhb/PhpstormProjects/php-src/test.php"
interactive = 0
lineno = 1
param_error = 0x0
hide_argv = 0
#10 0x0000000000cb0e9c in main (argc=11, argv=0x166f4a0) at /opt/php-src/sapi/cli/php_cli.c:1381
__orig_bailout = 0x0
__bailout = {{__jmpbuf = {23524960, 9027779415908237780, 4477888, 140737488348160, 0, 0, 9027779415948083668, -9027777826280357420}, __mask_was_saved = 0, __saved_mask = {
__val = {0, 0, 0, 0, 0, 0, 0, 0, 18374686479671623680, 0, 0, 1, 13351517, 0, 0, 13351440}}}}
c = -1
exit_status = 0
module_started = 1
sapi_started = 1
php_optarg = 0x166f5d0 "opcache.revalidate_freq=0"
php_optind = 10
use_extended_info = 0
ini_path_override = 0x0
ini_entries = 0x1670800 "html_errors=0\nregister_argc_argv=1\nimplicit_flush=1\noutput_buffering=0\nmax_execution_time=0\nmax_input_time=-1\nopcache.protect_memory=1\nopcache.enable_file_override=1\nopcache.validate_timestamps=1\nopca"...
ini_entries_len = 255
ini_ignore = 0
sapi_module = 0x1619180 <cli_sapi_module>
<?php
file_put_contents(__DIR__ . "/bug.php", "");
include __DIR__ . "/bug.php";
//file_put_contents(__DIR__ . "/bug.php", "<?php ");
var_dump(is_file(__DIR__ . "/bug.php"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment