Skip to content
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

Isolate the Chrome crash #26

Closed
wants to merge 198 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
5d20650
Reduced state and still crashing: No service worker, no messaging, ju…
adamziel Oct 3, 2022
1ebcd45
Reduced state, still crashing: no PHP code execution after the initia…
adamziel Oct 3, 2022
f4dbc74
Further reduced state: No imports. Still crashing!
adamziel Oct 3, 2022
665f1ae
Put the webworker code in setTimeout call – still crashing
adamziel Oct 3, 2022
cc20d17
Reduced state, no crashes, commented out new PHPWrapper() and php.init()
adamziel Oct 3, 2022
6c8c806
No crasehs: Restored new PHPWrapper( );
adamziel Oct 3, 2022
ba91296
Crashes: Restored php.init() -> it's crashing again!
adamziel Oct 3, 2022
848938a
Crashes: No default arguments to PhpBinary
adamziel Oct 3, 2022
df0b985
Crashes: new PHP with ccall pib_init
adamziel Oct 3, 2022
10f025e
Crashes: new PHP without ccall
adamziel Oct 3, 2022
508e7db
Crashes: without document = {}
adamziel Oct 3, 2022
523907c
Formatted webworker-php.js
adamziel Oct 3, 2022
0f067d3
Run prettier on webworker-php.js
adamziel Oct 3, 2022
fbc5928
Keeps crashing: Added early "return;" in run()!
adamziel Oct 3, 2022
b6bb7dc
Keeps crashing: ccall removed
adamziel Oct 3, 2022
fde20c8
Still crashing: Stripped more emscripten JS code
adamziel Oct 3, 2022
93569dc
Keeps crashing: Removed receiveInstantiatedSource – WASM isn't being …
adamziel Oct 3, 2022
7ed1ffd
Keeps crashing: Stripped asm2wasm to an empty function in instantiate…
adamziel Oct 3, 2022
cddbdc9
Keeps crashing: Replaced all functions in info.env with empty functions
adamziel Oct 3, 2022
0d333f2
Crash: Remove the system functions provided to wasm as they're distra…
adamziel Oct 3, 2022
bf68a6c
Crashes: Remove stacktrace handling code as it distracts and doesn't …
adamziel Oct 3, 2022
2f5790f
Crashes: Remove FS handling code as it's distracting and doesn't caus…
adamziel Oct 3, 2022
91208c6
Crashes: Remove usleep and ATINIT
adamziel Oct 3, 2022
34196e1
Crashes: Remove UTF-8 handling code
adamziel Oct 3, 2022
aa03a39
Crashes: Remove memory management code
adamziel Oct 3, 2022
71aa5db
Crashes: Remove unnecessary initialization code
adamziel Oct 3, 2022
1568e2c
Crashes: Remove dependency management
adamziel Oct 3, 2022
6da983c
Crashes: Remove non-essential initialization code
adamziel Oct 3, 2022
7db78ad
Crashes: Simplify the formatting
adamziel Oct 3, 2022
030a9a2
Crashes: Remove more non-essential initialization code
adamziel Oct 3, 2022
5be3673
Crashes: Remove more non-essential initialization code
adamziel Oct 3, 2022
d41d036
Crashes: Merge both webworker files into a single one to avoid callin…
adamziel Oct 3, 2022
963dc78
Crashes: Double the initial memory size
adamziel Oct 3, 2022
ce77f2d
Crashes: Move the WASM initialization code to the global scope
adamziel Oct 3, 2022
9bad613
Crashes: Remove more non-essential code
adamziel Oct 3, 2022
c4be5d7
Crashes: Remove , { credentials: 'same-origin' }
adamziel Oct 3, 2022
b3d747c
Reduce INITIAL_INITIAL_MEMORY to its original size
adamziel Oct 3, 2022
4edd1ec
No crash – build process that yields a reliable wasm binary
adamziel Oct 3, 2022
b34e8ed
No crash: Uses php_embed_shutdown but no php_embed_init
adamziel Oct 3, 2022
37ae5d5
Crash: sapi_startup
adamziel Oct 3, 2022
ec8607c
Crash: sapi_module = *(&php_embed_module);
adamziel Oct 3, 2022
4231c25
Crash: private_sapi_module
adamziel Oct 3, 2022
792c15a
No crash: php_embed_startup without php_module_startup
adamziel Oct 3, 2022
ff3800c
Crash: php_module_startup uncommented
adamziel Oct 3, 2022
819aa3a
Crash – zend_startup
adamziel Oct 3, 2022
8d533a5
Crash: gc_globals_ctor, zend_startup
adamziel Oct 3, 2022
b852a50
Crash; gc_globals_ctor
adamziel Oct 3, 2022
b150cbe
Crash: no gc_globals_ctor
adamziel Oct 3, 2022
050a119
Crash: no memset and php_startup_ticks
adamziel Oct 3, 2022
1d02d84
Crash: no sapi_activate
adamziel Oct 3, 2022
c0532c8
Crash: no sapi_initialize_empty_request
adamziel Oct 3, 2022
2559fc6
Crash: empty php_embed_startup
adamziel Oct 3, 2022
7b18686
Crash: half of php_embed_module2 empty
adamziel Oct 3, 2022
cec08ec
Crash: empty most of php_embed_module2
adamziel Oct 3, 2022
53d6b2d
Crash: empty php_embed_module2
adamziel Oct 3, 2022
1393b53
Crash: empty half of php_embed_init
adamziel Oct 3, 2022
2b5b2a5
Crash: empty php_embed_init
adamziel Oct 3, 2022
8c26c6c
No crash: empty php_embed_shutdown and a few other functions
adamziel Oct 3, 2022
7bc4504
No crash: empty just php_embed_shutdown
adamziel Oct 3, 2022
f1028ca
Crash: Just php_request_shutdown
adamziel Oct 3, 2022
13b3b9a
Crash: Only php_request_shutdown in pib_init
adamziel Oct 3, 2022
e2fc234
Crash: Only php_request_shutdown in pib_init
adamziel Oct 3, 2022
8f62c12
Crash: Inlined php_request_shutdown2
adamziel Oct 3, 2022
f3095d6
Crash: Half of php_request_shutdown2 empty
adamziel Oct 3, 2022
c12af31
Crash: 3/4 of php_request_shutdown2 empty
adamziel Oct 3, 2022
50f5868
No crash: 1/8 of php_request_shutdown2
adamziel Oct 3, 2022
2cdec88
Crash: Another 1/8 of the php_request_shutdown2
adamziel Oct 3, 2022
aeacfeb
Crash: Just php_call_shutdown_functions
adamziel Oct 3, 2022
6e784b6
Crash: brought php_call_shutdown_functions to pib_eval.c
adamziel Oct 4, 2022
75abc9f
Crash: Simplofy pib_eval.c
adamziel Oct 4, 2022
f6c195d
No crash: emopty user_shutdown_function_call2
adamziel Oct 4, 2022
78fa68d
No crash: Half of user_shutdown_function_call2
adamziel Oct 4, 2022
cfe7614
Crash: zend_call_function
adamziel Oct 4, 2022
4c8bc14
Crash: Minimal zend_call_function repro
adamziel Oct 4, 2022
98a5a19
No crash: Half of zend_call_function
adamziel Oct 4, 2022
489063a
Crash: zend_vm_stack_free_args zend_vm_stack_free_call_frame
adamziel Oct 4, 2022
b30df6e
No crash: without zend_vm_stack_free_args
adamziel Oct 4, 2022
eb5e461
Crash: cleanup
adamziel Oct 4, 2022
1beffaf
Crash: Cleanup
adamziel Oct 4, 2022
542a5d6
Crash: No loop
adamziel Oct 4, 2022
c0bb287
Crash: One if less
adamziel Oct 4, 2022
224e243
No crash: Removed big if
adamziel Oct 4, 2022
ed05fcf
Crash: Stripped down more supporting code in zend_call_function
adamziel Oct 4, 2022
ab12acf
No crash: Removed another chunk of supporting code
adamziel Oct 4, 2022
25ca966
Crash: Removed a different code path
adamziel Oct 4, 2022
9beb14c
Crash: Just zend_handle_undef_args
adamziel Oct 4, 2022
786df0e
Crash: Minimal crash reproduction with a copy of Zend/zend_execute.c
adamziel Oct 4, 2022
32b2d1f
Crash: Half of zend_handle_undef_args2
adamziel Oct 4, 2022
eb9efb5
Crash: zend_handle_undef_args2 further stripped dopwn
adamziel Oct 4, 2022
d9a6354
No crash: Removed start_fake_frame and zval_update_constant_ex from z…
adamziel Oct 4, 2022
6ac8c29
Crash: Just zval_update_constant_ex
adamziel Oct 4, 2022
f144ac9
Crash: zval_update_constant_ex ported to pib_eval.c
adamziel Oct 4, 2022
40d7f4c
Crash: One of
adamziel Oct 4, 2022
669d987
Crash: just zend_ast_evaluate
adamziel Oct 4, 2022
df66d63
Crash: One of (see the commit message below)
adamziel Oct 4, 2022
7c50534
Crash: One of zend_string_init(name, 10, 0); zend_string_equals_liter…
adamziel Oct 4, 2022
2c052aa
Crash: zend_fetch_class
adamziel Oct 4, 2022
7f48ad9
Crash: just zend_lookup_class_ex
adamziel Oct 4, 2022
8d902e3
Crash: zend_exception_save
adamziel Oct 4, 2022
56780d6
Crash: Copied zend_exception.c
adamziel Oct 4, 2022
acf28b7
Crash: Half of zend_exception_set_previous
adamziel Oct 4, 2022
0f15e9f
Crash: OBJ_RELEASE(add_previous);
adamziel Oct 4, 2022
bf4f0fa
Crash: zend_objects_store_del
adamziel Oct 4, 2022
9e88a99
Crash: Minimal repro with zend_objects_store_del
adamziel Oct 4, 2022
fafcad2
Crash: Half of zend_objects_store_del
adamziel Oct 4, 2022
40fec96
Crash: Almost the minimal repro with GC_SET_REFCOUND
adamziel Oct 4, 2022
8b66678
Crash: Minimal repro with object->handlers->dtor_obj != zend_objects_…
adamziel Oct 4, 2022
e285ebd
Crash: zend_call_known_instance_method_with_0_params
adamziel Oct 4, 2022
0d5a0ed
Back to zend_call_function but not pursuing zend_handle_undef_args this
adamziel Oct 4, 2022
06ee620
Crash: zend_call_function again, second half of the function removed
adamziel Oct 4, 2022
6e42626
Crash: Probably zend_is_callable_ex
adamziel Oct 4, 2022
3acb026
Crash: Zeroing in on a self-contained example without PHP in the mix
adamziel Oct 4, 2022
9643fdb
Crash: Reduced to free()
adamziel Oct 4, 2022
2aa4d7a
Crash: Got to zend_array
adamziel Oct 4, 2022
bbf046e
Narrowed down to zend_refcounted_h
adamziel Oct 4, 2022
723d374
Crash: Progress towards an isolated use case
adamziel Oct 4, 2022
42f9f3b
No crash: Defused code excerpt. Trying to arm it again
adamziel Oct 4, 2022
c201dfc
No crash: Trying to arm the defused code
adamziel Oct 4, 2022
70ca44c
Crash: Start debugging the WASM file directly
adamziel Oct 4, 2022
f273500
Crash: removed _zend_get_constant_ex
adamziel Oct 4, 2022
b39c959
Remove call $_zend_handle_encoding_declaration
adamziel Oct 4, 2022
be12f25
Removed _zend_compile_const_expr_class_name _zend_compile_const_expr_…
adamziel Oct 4, 2022
0b8aac0
Remove _zend_throw_or_error
adamziel Oct 4, 2022
0ad43b8
Remove a few more functions
adamziel Oct 4, 2022
a1be88b
Remove more functions
adamziel Oct 4, 2022
dc172f4
Remove more functions
adamziel Oct 4, 2022
4ae2118
Delete more functios
adamziel Oct 4, 2022
59c3ae9
Crash: Remove mallocs
adamziel Oct 4, 2022
4a09ec8
Crash: Use smaller initial memory
adamziel Oct 4, 2022
77d4291
Crash: Add python utils to reduce the wasm build bit by bit
adamziel Oct 5, 2022
b646a78
Crash: Iteration 2 of remove_unused_functions
adamziel Oct 5, 2022
47b6db1
Crash: Iteration #3 of remove_unused_functions
adamziel Oct 5, 2022
957f5b1
Crash: Iteration #4 of remove_unused_functions
adamziel Oct 5, 2022
925206f
Crash: Iteration #5 of remove_unused_functions
adamziel Oct 5, 2022
53bc9d9
Crash: removed (func $abortStackOverflow (type 0)
adamziel Oct 5, 2022
b3a3363
Crash: remove $_rc_dtor_func2
adamziel Oct 5, 2022
f739d9a
Crash: remove $_zend_throw_error
adamziel Oct 5, 2022
fd9eb0a
Crash: Remove $_memset
adamziel Oct 5, 2022
899dade
Crash: Remove $___errno_location
adamziel Oct 5, 2022
5f4a967
Crash: Remove $getTempRet0
adamziel Oct 5, 2022
b6cc0fe
Crash: Remove $_testSetjmp
adamziel Oct 5, 2022
7471b9e
Crash: Remove $_longjmp
adamziel Oct 5, 2022
d60d0e4
Crash: Remove $invoke_viii
adamziel Oct 5, 2022
474c74f
Crash: Remove $invoke_vii
adamziel Oct 5, 2022
ee26599
Crash: Remove $_zend_mm_alloc_small_slow
adamziel Oct 5, 2022
291255b
Crash: Remoe $_zend_mm_alloc_large
adamziel Oct 5, 2022
bc462af
Crash: Remove _free
adamziel Oct 5, 2022
af061f8
Crash: Remove $_zend_set_compiled_filename
adamziel Oct 5, 2022
d82a149
Crash: Remove $_zend_get_compiled_filename
adamziel Oct 5, 2022
737bcb0
Crash: Remove $_zend_get_compiled_lineno
adamziel Oct 5, 2022
0042c4c
Crash: Remove $_zend_is_compiling
adamziel Oct 5, 2022
b5cd1ec
Crash: Remove $_zend_stop_lexing
adamziel Oct 5, 2022
8aabf57
Crash: Remove $_memchr
adamziel Oct 5, 2022
f08b466
Crash: Remove $_zend_binary_strcasecmp
adamziel Oct 5, 2022
d1780f6
Crash: Remove $_zend_get_called_scope
adamziel Oct 5, 2022
9e839e2
Crash: Remove $_strlen
adamziel Oct 5, 2022
e04d6a1
Crash: Remove$_strcmp
adamziel Oct 5, 2022
8e64ec9
Crash: Remove $_get_binary_op
adamziel Oct 5, 2022
998f423
Crash: Remove $_get_unary_op
adamziel Oct 5, 2022
8b77ac2
Crash: Remove $$_zend_hash_index_find
adamziel Oct 5, 2022
5cb4b78
Crash: Remove $__zend_handle_numeric_str_ex
adamziel Oct 5, 2022
0082d93
Crash: Remove $_zend_ast_create_zval
adamziel Oct 5, 2022
c6d9b55
Crash: Remove $_rc_dtor_func]
adamziel Oct 5, 2022
53958ae
Crash: Remove $__zend_get_special_const
adamziel Oct 5, 2022
7ae1478
Crash: Remove zend_is_executing
adamziel Oct 5, 2022
5a30a35
Crash: Remove
adamziel Oct 5, 2022
d423f11
Crash: Remove $_zend_vm_stack_extend
adamziel Oct 5, 2022
e461945
Crash: Remove _zend_error_noreturn
adamziel Oct 5, 2022
c05b3ca
Crash: remove $__zend_hash_init
adamziel Oct 5, 2022
de6e1cf
Crash: remove $_zend_file_context_begin and zend_new_array
adamziel Oct 5, 2022
8713b0f
Crash: remove $_setitimer
adamziel Oct 5, 2022
dbdbf50
Crash: remove settimer
adamziel Oct 5, 2022
e3443ce
Crash: remove $_zend_str_tolower_copy
adamziel Oct 5, 2022
cbf1d71
Crash: remove f64-rem
adamziel Oct 5, 2022
38d904b
Crash: remove _zend_dval_to_lval_slow $_zend_get_type_by_const $_zend…
adamziel Oct 5, 2022
22232df
Crash: _zend_zval_type_name $_zend_type_error $_zend_class_implements…
adamziel Oct 5, 2022
d44d2ae
Crash: remove _zend_stack_init $_zend_stack_top $_zend_stack_del_top…
adamziel Oct 5, 2022
4739422
Crash: remove _get_filename_lineno $_zend_error $_zend_unmangle_prope…
adamziel Oct 5, 2022
a59c0dc
Remove $_zend_param_must_be_ref
adamziel Oct 5, 2022
a63969c
Remove $_zend_param_must_be_ref
adamziel Oct 5, 2022
532e16a
Crash: remove _gc_protect $__zend_bailout $_zend_parse_arg_bool_weak …
adamziel Oct 5, 2022
f97e119
Crash: remove _zend_read_property_ex $_zend_is_iterable $_memcmp $_ze…
adamziel Oct 5, 2022
a5dce8e
Crash: Removed functions $__zend_new_array_0 $__zend_hash_iterators_r…
adamziel Oct 5, 2022
4542046
Crash: Removed functions $__zval_undefined_op2 $__zval_undefined_op1 …
adamziel Oct 5, 2022
ef9415e
Crash: Removed functions $_zend_string_hash_func $_gc_remove_from_buf…
adamziel Oct 5, 2022
e2cb34e
Crash: Removed functions $__is_numeric_string_ex $_zend_try_ct_eval_c…
adamziel Oct 5, 2022
0d771e8
Crash: Removed functions $_zval_get_long_func $_zend_is_callable_ex $…
adamziel Oct 5, 2022
6edd810
Crash: Removed functions $_zend_binary_op_produces_error $_zend_parse…
adamziel Oct 5, 2022
cb84203
Crash: Removed functions $_zend_ast_evaluate2 $_printf $_pib_init2 $_…
adamziel Oct 5, 2022
ff8d458
Crash: Removed functions $_zend_add_member_modifier $_zend_throw_exce…
adamziel Oct 5, 2022
3e2d2b4
Tighten the max_updates check
adamziel Oct 5, 2022
718f0ac
Crash: Removed functions $_zendlex
adamziel Oct 5, 2022
3a85922
Crash: $_zend_negate_num_string
adamziel Oct 5, 2022
9f438d2
Crash: Remove call to $_lex_scan
adamziel Oct 5, 2022
966cf5c
Crash: Remove almost all function calls from _lex_scan
adamziel Oct 5, 2022
6f569d3
Crash: Remove ALL function calls from inside _lex_scan
adamziel Oct 5, 2022
18d3010
Crash: remove all functions other than _lex_scan
adamziel Oct 5, 2022
c95f094
Crash: Remove unused imports
adamziel Oct 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.DS_Store
node_modules
package-lock.json
wasm-build/php/docker-output/*
!wasm-build/php/docker-output/.gitkeep
wasm-build/wordpress-data/docker-output/*
!wasm-build/wordpress-data/docker-output/.gitkeep
wasm-build/wordpress-data/preload/wordpress*
64 changes: 1 addition & 63 deletions dist-web/app.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,4 @@
(() => {
// src/shared/messaging.mjs
function postMessageFactory(target) {
let lastRequestId = 0;
return function postMessage(data, timeout = 5e4) {
return new Promise((resolve, reject) => {
const requestId = ++lastRequestId;
const responseHandler = (event) => {
if (event.data.type === "response" && event.data.requestId === requestId) {
target.removeEventListener("message", responseHandler);
clearTimeout(failOntimeout);
resolve(event.data.result);
}
};
const failOntimeout = setTimeout(() => {
reject("Request timed out");
target.removeEventListener("message", responseHandler);
}, timeout);
target.addEventListener("message", responseHandler);
target.postMessage({
...data,
requestId
});
});
};
}
function replyTo(event, result, target) {
target.postMessage({
type: "response",
requestId: event.data.requestId,
result
}, event.origin);
}

// src/web/app.mjs
if (!navigator.serviceWorker) {
alert("Service workers are not supported by your browser");
}
var serviceWorkerReady = navigator.serviceWorker.register(`/service-worker.js`);
var myWebWorker = new Worker("web-worker.js");
var webWorkerReady = new Promise((resolve) => {
const callback = (event) => {
if (event.data.type === "ready") {
resolve();
myWebWorker.removeEventListener("message", callback);
}
};
myWebWorker.addEventListener("message", callback);
});
async function init() {
await serviceWorkerReady;
await webWorkerReady;
const postMessage = postMessageFactory(myWebWorker);
window.addEventListener("message", async (event) => {
if (event.data.type === "goto") {
document.querySelector("iframe").src = event.data.path;
}
console.log("[APP.js] Got a message", event);
const response = await postMessage(event.data);
console.log("[APP.js] Got a response", response);
replyTo(event, response, parent);
});
document.querySelector("iframe").src = "/wp-login.php";
}
init();
new Worker("web-worker.js");
})();
Binary file added dist-web/fix.wasm
Binary file not shown.
Binary file added dist-web/php-disabled-all-and-more.wasm
Binary file not shown.
Binary file added dist-web/php-disabled-all.wasm
Binary file not shown.
Binary file added dist-web/php-extra-exported-methods.wasm
Binary file not shown.
Binary file added dist-web/php-minimal-pib_eval.wasm
Binary file not shown.
Binary file added dist-web/php.wasm
Binary file not shown.
Loading