From cefced6af511602c84216dc0f5397f7b8bd157cf Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 22:39:18 +0800 Subject: [PATCH 01/13] test1 - add JUMP_BUF to PhpgoBaseContext --- .gitignore | 1 + src/phpgo_context.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fa48430..fe9d838 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ tests/*.exp tests/*.log tests/*.sh core.* +ftp-sync.json diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 18fa79f..155d39c 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -215,9 +215,10 @@ struct PhpgoBaseContext{ uint64_t task_id; bool http_globals_cleanup_required; + struct _zend_execute_data* EG_current_execute_data; + JUMP_BUF* EG_jump_buf; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ - struct _zend_execute_data* EG_current_execute_data; zend_vm_stack EG_argument_stack; zend_class_entry* EG_scope; zval* EG_This; @@ -236,7 +237,6 @@ struct PhpgoBaseContext{ TSRMLS_FIELD; /*ZTS: void ***tsrm_ls;*/ #else /* php7 */ - struct _zend_execute_data* EG_current_execute_data; zend_vm_stack EG_vm_stack; zval* EG_vm_stack_top; zval* EG_vm_stack_end; From b7084a2cb90d18bcb2fc85502364d2d8f8ca0816 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 22:44:39 +0800 Subject: [PATCH 02/13] test --- src/phpgo_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 155d39c..a4fde4f 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,7 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - JUMP_BUF* EG_jump_buf; + JMP_BUF* EG_bailout; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; From 1652e9b5f2802ff1422d5c68b83d6a8641b7fd13 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 22:48:33 +0800 Subject: [PATCH 03/13] test --- .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index b891189..6b4aa69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,13 @@ compiler: - gcc php: - - '5.4' - - '5.5' - - '5.6' - - '7.0' - - '7.1' - - '7.2' + #- '5.4' + #- '5.5' + #- '5.6' + - '7.0.17' + - '7.0.18' + - '7.1.7' + - '7.2.0' before_install: - php --ini From be2aa3c776252957311eb38b1933e0ed0ad3cf24 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 22:59:49 +0800 Subject: [PATCH 04/13] test --- src/phpgo_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index a4fde4f..0b47349 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,7 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - JMP_BUF* EG_bailout; + void* EG_bailout; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; From dfee0062303398718e69c709ae1f4ec9be2ef84f Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 23:17:38 +0800 Subject: [PATCH 05/13] test --- src/phpgo_context.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 0b47349..f434386 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -217,6 +217,7 @@ struct PhpgoBaseContext{ struct _zend_execute_data* EG_current_execute_data; void* EG_bailout; + char buffer[128]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; From e582e4d472633e2689846eaaa9458da70a0a81f0 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 23:37:16 +0800 Subject: [PATCH 06/13] test --- src/phpgo_context.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index f434386..1e42a64 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,8 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - void* EG_bailout; - char buffer[128]; + char buffer[4]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; From 4539ba61a287466144d643abeebe2e9ef63057cc Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 23:44:11 +0800 Subject: [PATCH 07/13] test --- src/phpgo_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 1e42a64..bf6d33c 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,7 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - char buffer[4]; + char buffer[16]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; From ced4071098be2c365975345ddbd500bc09b8c5e2 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 23:50:20 +0800 Subject: [PATCH 08/13] test --- src/phpgo_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index bf6d33c..75e3e17 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,7 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - char buffer[16]; + char buffer[32]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; From 2aa7c49004fd0983de736dd47e27403278ddb498 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Sun, 5 Aug 2018 23:51:16 +0800 Subject: [PATCH 09/13] test64 --- src/phpgo_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 75e3e17..20e608d 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,7 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - char buffer[32]; + char buffer[64]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; From 8d818e06f2c3e1f652a77b5e107ceaa6aa4d8124 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Mon, 6 Aug 2018 00:12:40 +0800 Subject: [PATCH 10/13] test --- src/phpgo_context.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 20e608d..d0dab02 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,7 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - char buffer[64]; + uint64_t guard[8]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; @@ -247,6 +247,7 @@ struct PhpgoBaseContext{ /**/ PhpgoBaseContext(){ bzero(this, sizeof(*this)); + memset(guard, 0xcc, sizeof(guard)); PHP7_AND_ABOVE( for(int i=0; i< NUM_TRACK_VARS; i++) @@ -286,6 +287,11 @@ struct PhpgoBaseContext{ this->EG_vm_stack_top = EG(vm_stack_top ); this->EG_vm_stack_end = EG(vm_stack_end ); #endif + for(int i=0; i<8; i++){ + if (guard[i]!=0xcccccccc) { + printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); + } + } } inline void SwapIn(bool include_http_globals){ @@ -318,6 +324,12 @@ struct PhpgoBaseContext{ REPLACE_PG_HTTP_GLOBALS_WITH(this->PG_http_globals); SET_HTTP_GLOBALS(this->PG_http_globals, this->http_request_global); } + + for(int i=0; i<8; i++){ + if (guard[i]!=0xcccccccc) { + printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); + } + } } public: From 1cabf2bd16ba25f4d5e38fab6203290ebef62a50 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Mon, 6 Aug 2018 00:14:37 +0800 Subject: [PATCH 11/13] test --- src/phpgo_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index d0dab02..2972231 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -288,7 +288,7 @@ struct PhpgoBaseContext{ this->EG_vm_stack_end = EG(vm_stack_end ); #endif for(int i=0; i<8; i++){ - if (guard[i]!=0xcccccccc) { + if (guard[i]!=0xcccccccccccccccc) { printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); } } @@ -326,7 +326,7 @@ struct PhpgoBaseContext{ } for(int i=0; i<8; i++){ - if (guard[i]!=0xcccccccc) { + if (guard[i]!=0xcccccccccccccccc) { printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); } } From f18da51254097d991e2420ed271b510da57f14f8 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Mon, 6 Aug 2018 00:21:57 +0800 Subject: [PATCH 12/13] test --- src/phpgo_context.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 2972231..7783cea 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -216,7 +216,7 @@ struct PhpgoBaseContext{ bool http_globals_cleanup_required; struct _zend_execute_data* EG_current_execute_data; - uint64_t guard[8]; + uint64_t guard[128]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; @@ -287,7 +287,7 @@ struct PhpgoBaseContext{ this->EG_vm_stack_top = EG(vm_stack_top ); this->EG_vm_stack_end = EG(vm_stack_end ); #endif - for(int i=0; i<8; i++){ + for(int i=0; i<128; i++){ if (guard[i]!=0xcccccccccccccccc) { printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); } @@ -325,7 +325,7 @@ struct PhpgoBaseContext{ SET_HTTP_GLOBALS(this->PG_http_globals, this->http_request_global); } - for(int i=0; i<8; i++){ + for(int i=0; i<128; i++){ if (guard[i]!=0xcccccccccccccccc) { printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); } From 7da867e7c6620daff0b121f463799c0edd51adb3 Mon Sep 17 00:00:00 2001 From: michaelwei Date: Mon, 6 Aug 2018 00:33:09 +0800 Subject: [PATCH 13/13] test --- src/phpgo_context.h | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/phpgo_context.h b/src/phpgo_context.h index 7783cea..c250079 100644 --- a/src/phpgo_context.h +++ b/src/phpgo_context.h @@ -212,11 +212,10 @@ do{ \ #endif struct PhpgoBaseContext{ + uint64_t guard__[64]; uint64_t task_id; bool http_globals_cleanup_required; - struct _zend_execute_data* EG_current_execute_data; - uint64_t guard[128]; #if PHP_MAJOR_VERSION < 7 /*go routine running environment*/ zend_vm_stack EG_argument_stack; @@ -244,10 +243,16 @@ struct PhpgoBaseContext{ zval PG_http_globals[NUM_TRACK_VARS]; zval http_request_global; #endif + + struct _zend_execute_data* EG_current_execute_data; + JMP_BUF* EG_bailout; + + uint64_t __guard[64]; /**/ PhpgoBaseContext(){ bzero(this, sizeof(*this)); - memset(guard, 0xcc, sizeof(guard)); + memset(guard__, 0xcc, sizeof(guard__)); + memset(__guard, 0xcc, sizeof(__guard)); PHP7_AND_ABOVE( for(int i=0; i< NUM_TRACK_VARS; i++) @@ -287,9 +292,12 @@ struct PhpgoBaseContext{ this->EG_vm_stack_top = EG(vm_stack_top ); this->EG_vm_stack_end = EG(vm_stack_end ); #endif - for(int i=0; i<128; i++){ - if (guard[i]!=0xcccccccccccccccc) { - printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); + for(int i=0; i<64; i++){ + if (guard__[i]!=0xcccccccccccccccc) { + printf("!!!: guard__ was overwritten! address: %p, value:%lx\n", &guard__[i], guard__[i]); + } + if (__guard[i]!=0xcccccccccccccccc) { + printf("!!!: __guard was overwritten! address: %p, value:%lx\n", &__guard[i], __guard[i]); } } } @@ -325,9 +333,12 @@ struct PhpgoBaseContext{ SET_HTTP_GLOBALS(this->PG_http_globals, this->http_request_global); } - for(int i=0; i<128; i++){ - if (guard[i]!=0xcccccccccccccccc) { - printf("!!!: guard was overwritten! address: %p, value:%lx\n", &guard[i], guard[i]); + for(int i=0; i<64; i++){ + if (guard__[i]!=0xcccccccccccccccc) { + printf("!!!: guard__ was overwritten! address: %p, value:%lx\n", &guard__[i], guard__[i]); + } + if (__guard[i]!=0xcccccccccccccccc) { + printf("!!!: __guard was overwritten! address: %p, value:%lx\n", &__guard[i], __guard[i]); } } }