0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/tools
Joyee Cheung 7cbbb27c07
src: perform integrity checks on built-in code cache
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>
2018-08-18 05:21:52 +08:00
..
bootstrap
clang-format tools: add make format-cpp to run clang-format on C++ diffs 2018-08-03 19:40:23 +08:00
configure.d
doc fs: readdir optionally returning type information 2018-08-13 19:18:45 -07:00
eslint-rules tools: add no-duplicate-requires rule 2018-07-12 16:11:11 -05:00
gyp tools: patch gyp to avoid xcrun errors 2018-07-29 20:27:31 +05:30
icu
inspector_protocol inspector: add inspector_protocol as a direct dependency 2018-08-10 18:03:43 -07:00
jinja2 inspector: add inspector_protocol as a direct dependency 2018-08-10 18:03:43 -07:00
macos-installer
markupsafe inspector: add inspector_protocol as a direct dependency 2018-08-10 18:03:43 -07:00
msvs build,win,v8: allow precompiling objects-inl.h 2018-07-27 00:43:43 -07:00
node_modules tools: update ESLint to 5.3.0 2018-08-07 22:28:45 -07:00
pkgsrc src,tools: use https://nodejs.org URL when possible. 2018-07-14 11:57:59 +02:00
remark-cli
remark-preset-lint-node
rpm src,tools: use https://nodejs.org URL when possible. 2018-07-14 11:57:59 +02:00
.eslintrc.yaml
build-addons.js build: build addon tests in parallel 2018-06-11 20:09:28 +02:00
certdata.txt
check_macros.py
check-imports.py
compress_json.py
cpplint.py tools: update cpplint to check for inline headers 2018-07-29 19:13:00 +05:30
create_android_makefiles
create_expfile.sh
dcheck_macros.py
generate_code_cache.js src: perform integrity checks on built-in code cache 2018-08-18 05:21:52 +08:00
genv8constants.py
getmoduleversion.py
getnodeversion.py tools: make getnodeversion.py python3-compatible 2018-07-19 19:19:30 +02:00
gyp_node.py
install.py tools: properly convert .gypi in install.py 2018-07-19 11:52:16 +02:00
js2c.py src: perform integrity checks on built-in code cache 2018-08-18 05:21:52 +08:00
license2rtf.js
license-builder.sh inspector: add inspector_protocol as a direct dependency 2018-08-10 18:03:43 -07:00
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 worker: rename to worker_threads 2018-06-06 19:44:15 +02:00
sign.bat
specialize_node_d.py
test-npm-package.js
test-v8.bat
test.py test: remove test/gc, integrate into parallel 2018-08-01 18:04:56 +02:00
update-authors.sh
update-babel-eslint.sh tools: update to using dmn 1.0.11 2018-08-01 22:46:34 -07:00
update-eslint.sh tools: update to using dmn 1.0.11 2018-08-01 22:46:34 -07:00
utils.py