mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
7cbbb27c07
Currently V8 only checks that the length of the source code is the same as the code used to generate the hash, so we add an additional check here: 1. During compile time, when generating node_javascript.cc and node_code_cache.cc, we compute and include the hash of the (unwrapped) JavaScript source in both. 2. At runtime, we check that the hash of the code being compiled and the hash of the code used to generate the cache (inside the wrapper) is the same. This is based on the assumptions: 1. `internalBinding('code_cache_hash')` must be in sync with `internalBinding('code_cache')` (same C++ file) 2. `internalBinding('natives_hash')` must be in sync with `process.binding('natives')` (same C++ file) 3. If `internalBinding('natives_hash')` is in sync with `internalBinding('natives_hash')`, then the (unwrapped) code used to generate `internalBinding('code_cache')` should be in sync with the (unwrapped) code in `process.binding('natives')` There will be, however, false positives if the wrapper used to generate the cache is different from the one used at run time, and the length of the wrapper somehow stays the same. But that should be rare and can be eased once we make the two bootstrappers cached and checked as well. PR-URL: https://github.com/nodejs/node/pull/22152 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> |
||
---|---|---|
.. | ||
bootstrap | ||
clang-format | ||
configure.d | ||
doc | ||
eslint-rules | ||
gyp | ||
icu | ||
inspector_protocol | ||
jinja2 | ||
macos-installer | ||
markupsafe | ||
msvs | ||
node_modules | ||
pkgsrc | ||
remark-cli | ||
remark-preset-lint-node | ||
rpm | ||
.eslintrc.yaml | ||
build-addons.js | ||
certdata.txt | ||
check_macros.py | ||
check-imports.py | ||
compress_json.py | ||
cpplint.py | ||
create_android_makefiles | ||
create_expfile.sh | ||
dcheck_macros.py | ||
generate_code_cache.js | ||
genv8constants.py | ||
getmoduleversion.py | ||
getnodeversion.py | ||
gyp_node.py | ||
install.py | ||
js2c.py | ||
license2rtf.js | ||
license-builder.sh | ||
lint-js.js | ||
lsan_suppressions.txt | ||
macos-firewall.sh | ||
make-v8.sh | ||
mk-ca-bundle.pl | ||
mkssldef.py | ||
nodcheck_macros.py | ||
osx-codesign.sh | ||
osx-pkg-postinstall.sh | ||
osx-productsign.sh | ||
release.sh | ||
run-valgrind.py | ||
run-worker.js | ||
sign.bat | ||
specialize_node_d.py | ||
test-npm-package.js | ||
test-v8.bat | ||
test.py | ||
update-authors.sh | ||
update-babel-eslint.sh | ||
update-eslint.sh | ||
utils.py |