Rich Trott
aa9dbf666b
test: apply promises API to fourth appendFile test
...
Add tests for `fs.promises.appendFile()` to the fourth (of five) test
case in `test-fs-access`. (The previous test cases already have
promises API versions.)
PR-URL: https://github.com/nodejs/node/pull/21131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-06-13 08:45:04 +02:00
Rich Trott
185b9e45d3
test: apply promises API to third appendFile test
...
Add tests for `fs.promises.appendFile()` to the third (of five) test
case in `test-fs-access`. (First and second test cases already have
promises API versions.)
PR-URL: https://github.com/nodejs/node/pull/21131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-06-13 08:45:04 +02:00
Daniel Bevenius
cbdc1fdf44
src, tools: add check for left leaning pointers
...
This commit adds a rule to cpplint to check that pointers in the code
base lean to the left and not right, and also fixes the violations
reported.
PR-URL: https://github.com/nodejs/node/pull/21010
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-06-13 08:45:04 +02:00
Rich Trott
c400448e85
test: improve debug output in trace-events test
...
test-trace-events-fs-sync is swallowing useful information when it
fails. This change results in more information being displayed.
PR-URL: https://github.com/nodejs/node/pull/21120
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Lance Ball <lball@redhat.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-06-13 08:45:04 +02:00
Matheus Marchini
a4ad9891e3
test: add test for Linux perf
...
This commit adds a test to validate if Linux perf is working correctly
on Node.js. The test is marked as flaky because its intention is to let
us know when changes on V8 potentially broke Linux perf, so we can fix
it before a new version of V8 lands on Node.js master.
PR-URL: https://github.com/nodejs/node/pull/20783
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-06-13 08:45:04 +02:00
Matheus Marchini
e16036c462
test: create new directory v8-updates
...
`v8-updates` holds all tests related to V8 updates, for example, testing
for postmortem metadata chages.
PR-URL: https://github.com/nodejs/node/pull/20783
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-06-13 08:45:04 +02:00
Anna Henningsen
03fbc9e749
worker: rename to worker_threads
...
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:04 +02:00
Anna Henningsen
6caa354377
doc: explain Worker semantics in async_hooks.md
...
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Anna Henningsen
ed05d9a821
test,tools: enable running tests under workers
...
Enable running tests inside workers by passing `--worker`
to `tools/test.py`. A number of tests are marked as skipped,
or have been slightly altered to fit the different environment.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Anna Henningsen
9ad42b766e
worker: improve error (de)serialization
...
Rather than passing errors using some sort of string representation,
do a best effort for faithful serialization/deserialization of
uncaught exception objects.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Timothy Gu
ecba1c57b1
benchmark: port cluster/echo to worker
...
$ ./node benchmark/cluster/echo.js
cluster/echo.js n=100000 sendsPerBroadcast=1 payload="string" workers=1: 33,647.30473442063
cluster/echo.js n=100000 sendsPerBroadcast=10 payload="string" workers=1: 12,927.907405288383
cluster/echo.js n=100000 sendsPerBroadcast=1 payload="object" workers=1: 28,496.37373941151
cluster/echo.js n=100000 sendsPerBroadcast=10 payload="object" workers=1: 8,975.53747186485
$ ./node --experimental-worker benchmark/worker/echo.js
worker/echo.js n=100000 sendsPerBroadcast=1 payload="string" workers=1: 88,044.32902365089
worker/echo.js n=100000 sendsPerBroadcast=10 payload="string" workers=1: 39,873.33697018837
worker/echo.js n=100000 sendsPerBroadcast=1 payload="object" workers=1: 64,451.29132425621
worker/echo.js n=100000 sendsPerBroadcast=10 payload="object" workers=1: 22,325.635443739284
Refs: https://github.com/ayojs/ayo/pull/115
Reviewed-By: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Anna Henningsen
6b1a887aa2
worker: enable stdio
...
Provide `stdin`, `stdout` and `stderr` options for the `Worker`
constructor, and make these available to the worker thread
under their usual names.
The default for `stdin` is an empty stream, the default for
`stdout` and `stderr` is redirecting to the parent thread’s
corresponding stdio streams.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Timothy Gu
c97fb91e55
worker: restrict supported extensions
...
Only allow `.js` and `.mjs` extensions to provide future-proofing
for file type detection.
Refs: https://github.com/ayojs/ayo/pull/117
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Olivia Hugger <olivia@fastmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Timothy Gu
93ce63c89f
test: add test against unsupported worker features
...
Refs: https://github.com/ayojs/ayo/pull/113
Reviewed-By: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Anna Henningsen
109c92e8fa
worker: initial implementation
...
Implement multi-threading support for most of the API.
Thanks to Stephen Belanger for reviewing this change in its
original form, to Olivia Hugger for reviewing the
documentation and some of the tests coming along with it,
and to Alexey Orlenko and Timothy Gu for reviewing other
parts of the tests.
Refs: https://github.com/ayojs/ayo/pull/110
Refs: https://github.com/ayojs/ayo/pull/114
Refs: https://github.com/ayojs/ayo/pull/117
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:45:03 +02:00
Timothy Gu
314b47d1cf
src: add Env::profiler_idle_notifier_started()
...
Refs: https://github.com/ayojs/ayo/pull/93
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:40 +02:00
Daniel Bevenius
5209ff9562
src: remove unused fields msg_ and env_
...
Currently the following compiler warnings are generated:
../src/node_messaging.cc:74:16:
warning: private field 'env_' is not used [-Wunused-private-field]
Environment* env_;
^
../src/node_messaging.cc:75:12:
warning: private field 'msg_' is not used [-Wunused-private-field]
Message* msg_;
^
2 warnings generated.
This commit removes these unused private members.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:40 +02:00
Anna Henningsen
d1f372f052
worker: add SharedArrayBuffer sharing
...
Logic is added to the `MessagePort` mechanism that
attaches hidden objects to those instances when they are transferred
that track their lifetime and maintain a reference count, to make
sure that memory is freed at the appropriate times.
Thanks to Stephen Belanger for reviewing this change in its original PR.
Refs: https://github.com/ayojs/ayo/pull/106
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:39 +02:00
Anna Henningsen
f447acd87b
worker: support MessagePort passing in messages
...
Support passing `MessagePort` instances through other `MessagePort`s,
as expected by the `MessagePort` spec.
Thanks to Stephen Belanger for reviewing this change in its original PR.
Refs: https://github.com/ayojs/ayo/pull/106
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:39 +02:00
Anna Henningsen
337be58ee6
worker: implement MessagePort and MessageChannel
...
Implement `MessagePort` and `MessageChannel` along the lines of
the DOM classes of the same names. `MessagePort`s initially
support transferring only `ArrayBuffer`s.
Thanks to Stephen Belanger for reviewing this change in its
original form, to Benjamin Gruenbaum for reviewing the
added tests in their original form, and to Olivia Hugger
for reviewing the documentation in its original form.
Refs: https://github.com/ayojs/ayo/pull/98
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:39 +02:00
Anna Henningsen
9a734132f9
src: make handle onclose property a Symbol
...
This makes the property “more” hidden when exposing a `HandleWrap`
as public API, e.g. for upcoming `MessagePort`s.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:39 +02:00
Anna Henningsen
e6f06807b1
src: simplify handle closing
...
Remove one extra closing state and use a smart pointer for
deleting `HandleWrap`s.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:39 +02:00
Daniel Bevenius
65924c70e8
src: remove unused fields isolate_
...
Currently the following compiler warnings are generated:
In file included from ../src/node_platform.cc:1:
../src/node_platform.h:83:16:
warning: private field 'isolate_' is not used [-Wunused-private-field]
v8::Isolate* isolate_;
^
1 warning generated.
This commit removes these unused private member.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:39 +02:00
Anna Henningsen
de7403f813
src: cleanup per-isolate state on platform on isolate unregister
...
Clean up once all references to an `Isolate*` are gone from the
`NodePlatform`, rather than waiting for the `PerIsolatePlatformData`
struct to be deleted since there may be cyclic references between
that struct and the individual tasks.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-13 08:43:39 +02:00
Gabriel Schulhof
9047c8182c
n-api: remove unused napi_env member
...
`wrap_template` is no longer used since we've switched to v8::Private.
PR-URL: https://github.com/nodejs/node/pull/21127
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2018-06-13 08:43:39 +02:00
Mathias Buus
a6986fe8b6
async_hooks: remove deprecated example
...
PR-URL: https://github.com/nodejs/node/pull/20998
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:43:39 +02:00
Joyee Cheung
c09bfd81b7
fs: do not crash when using a closed fs event watcher
...
Before this commit, when the user calls methods on a closed or
errored fs event watcher, they could hit a crash since the
FSEventWrap in C++ land may have already been destroyed with
the internal pointer set to nullptr. This commit makes sure
that the user cannot hit crashes like that, instead the
methods calling on a closed watcher will be noops.
Also explicitly documents that the watchers should not be used
in `close` and `error` event handlers.
PR-URL: https://github.com/nodejs/node/pull/20985
Fixes: https://github.com/nodejs/node/issues/20738
Fixes: https://github.com/nodejs/node/issues/20297
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ron Korving <ron@ronkorving.nl >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:43:39 +02:00
Joyee Cheung
b4b7d368be
lib: unmask mode_t values with 0o777
...
This commit allows permission bits higher than 0o777 to go through
the API (e.g. `S_ISVTX`=`0o1000`, `S_ISGID`=`0o2000`,
`S_ISUID`=`0o4000`).
Also documents that these bits are not exposed through `fs.constants`
and their behaviors are platform-specific, so the users need to
use them on their own risk.
PR-URL: https://github.com/nodejs/node/pull/20975
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:43:39 +02:00
Davis Okoth
9f9355d6d2
doc: fix inconsistent documentation (host vs hostname)
...
Update reference to read `hostname` instead of `host` for consistency.
Also update function signature to use `hostname` rather than `host`
PR-URL: https://github.com/nodejs/node/pull/20933
Refs: https://github.com/nodejs/node/issues/20892
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
James M Snell
ba17c9e46b
src: refactor bootstrap to use bootstrap object
...
PR-URL: https://github.com/nodejs/node/pull/20917
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
Masashi Hirano
94dcdfb898
test: increase coverage for fs.promises.truncate
...
To increase test coverage, added tests for fs.promises.truncate
and FileHandle.truncate.
PR-URL: https://github.com/nodejs/node/pull/20638
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
James M Snell
bacb2cb550
fs: refactor fs module
...
PR-URL: https://github.com/nodejs/node/pull/20764
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
cjihrig
db0bb5214a
fs: improve fchmod{Sync} validation
...
This commit validates the fd parameters to fs.fchmod{Sync} as
int32s instead of uint32s because they are ints in the binding
layer.
PR-URL: https://github.com/nodejs/node/pull/20588
Fixes: https://github.com/nodejs/node/issues/20498
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
cjihrig
36e5100a39
lib: support ranges in validateInt32()
...
This commit adds minimum and maximum value checks to the
validateInt32() validator.
PR-URL: https://github.com/nodejs/node/pull/20588
Fixes: https://github.com/nodejs/node/issues/20498
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
Сковорода Никита Андреевич
2ffb9d6b5c
fs: drop duplicate API in promises mode
...
This drops exporting duplicate methods that accept FileHandle as the
first argument (to mirror callback-based methods accepting 'fd').
Those methods were not adding actual value to the API because all of
those are already present as FileHandle methods, and they would
probably be confusing to the new users and making docs harder to read.
Also, the API was a bit inconsistent and lacked .close(handle).
Fixes: https://github.com/nodejs/node/issues/20548
PR-URL: https://github.com/nodejs/node/pull/20559
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
Joyee Cheung
a5c571424a
doc: document file mode caveats on Windows
...
- On Windows only the write permission (read-only bit) can be
manipulated, and there is no distinction among owner, group
or others.
- mkdir on Windows does not support the mode argument.
PR-URL: https://github.com/nodejs/node/pull/20636
Fixes: https://github.com/nodejs/node/issues/20498
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
Joyee Cheung
2fe88d2218
lib: mask mode_t type of arguments with 0o777
...
- Introduce the `validateAndMaskMode` validator that
validates `mode_t` arguments and mask them with 0o777
if they are 32-bit unsigned integer or octal string
to be more consistent with POSIX APIs.
- Use the validator in fs APIs and process.umask for
consistency.
- Add tests for 32-bit unsigned modes larger than 0o777.
PR-URL: https://github.com/nodejs/node/pull/20636
Fixes: https://github.com/nodejs/node/issues/20498
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21172
2018-06-13 08:41:48 +02:00
Michaël Zasso
fc2956d37a
process: backport process/methods file
...
To ease future backports, create the process/methods file introduced in
https://github.com/nodejs/node/pull/19973 . This commit just adds
the JS functions that forward calls to C++ and does not change type
checking.
PR-URL: https://github.com/nodejs/node/pull/21172
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-06-13 08:41:25 +02:00
cjihrig and Shelley Vohr
fc0b3610e2
fs: don't limit ftruncate() length to 32 bits
...
The length used by ftruncate() is 64 bits in the binding layer.
This commit removes the 32 bit restriction in the JS layer.
Backport-PR-URL: https://github.com/nodejs/node/pull/21171
PR-URL: https://github.com/nodejs/node/pull/20851
Fixes: https://github.com/nodejs/node/issues/20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com >
2018-06-13 08:41:25 +02:00
cjihrig and Shelley Vohr
469baa062e
fs: add length validation to fs.truncate()
...
This commit adds validation to the length parameter of
fs.truncate(). Prior to this commit, passing a non-number would
trigger a CHECK() in the binding layer.
Backport-PR-URL: https://github.com/nodejs/node/pull/21171
PR-URL: https://github.com/nodejs/node/pull/20851
Fixes: https://github.com/nodejs/node/issues/20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com >
2018-06-13 08:39:09 +02:00
cjihrig and Shelley Vohr
a0cfb0c9d4
lib: add validateInteger() validator
...
This allows validation of integers that are not int32 or uint32.
PR-URL: https://github.com/nodejs/node/pull/20851
Fixes: https://github.com/nodejs/node/issues/20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com >
2018-06-13 08:39:09 +02:00
Evan Lucas
6a098ad965
Working on v10.4.2
...
PR-URL: https://github.com/nodejs-private/node-private/pull/136
2018-06-12 18:43:28 -05:00
Evan Lucas
1442cfef73
2018-06-12, Version 10.4.1 (Current)
...
Notable changes:
* **Fixes memory exhaustion DoS** (CVE-2018-7164): Fixes a bug introduced
in 9.7.0 that increases the memory consumed when reading from the network
into JavaScript using the net.Socket object directly as a stream.
* **http2**
* (CVE-2018-7161): Fixes Denial of Service vulnerability by updating the
http2 implementation to not crash under certain circumstances during cleanup
* (CVE-2018-1000168): Fixes Denial of Service vulnerability by upgrading
nghttp2 to 1.32.0
* **tls** (CVE-2018-7162): Fixes Denial of Service vulnerability by updating
the TLS implementation to not crash upon receiving
* **n-api**: Prevent use-after-free in napi_delete_async_work
PR-URL: https://github.com/nodejs-private/node-private/pull/136
v10.4.1
2018-06-12 13:47:23 -05:00
James M Snell
ae5567eaea
test: add regression test for nghttp2 CVE-2018-1000168
...
PR-URL: https://github.com/nodejs-private/node-private/pull/117
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-06-12 13:46:52 -05:00
James M Snell
4c90ee8fc6
deps: update to nghttp2 1.32.0
...
This fixes CVE-2018-1000168.
PR-URL: https://github.com/nodejs-private/node-private/pull/117
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-06-12 13:46:52 -05:00
James M Snell
8681402228
http2: fixup http2stream cleanup and other nits
...
This fixes CVE-2018-7161.
PR-URL: https://github.com/nodejs-private/node-private/pull/115
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-06-12 13:46:52 -05:00
Anna Henningsen
9ba8ed1371
src: re-add Realloc() shrink after reading stream data
...
This would otherwise keep a lot of unused memory lying around,
and in particular add up to a page per chunk of memory overhead
for network reads, potentially opening a DoS vector if the resulting
`Buffer` objects are kept around indefinitely (e.g. stored in a list
and not concatenated until the socket finishes).
This fixes CVE-2018-7164.
Refs: https://github.com/nodejs-private/security/issues/186
Refs: https://github.com/nodejs/node/commit/7c4b09b24bbe7d6a8cbad256f47b30a101a909ea
PR-URL: https://github.com/nodejs-private/node-private/pull/128
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-06-12 13:46:52 -05:00
Shigeki Ohtsu
e87bf625dd
test: add tls write error regression test
...
Add a mock TLS socket implementation and a regression test for
the previous commit.
Refs: https://github.com/nodejs-private/security/issues/189
PR-URL: https://github.com/nodejs-private/node-private/pull/127
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-06-12 05:16:55 -05:00
Anna Henningsen
eea2bce58d
tls: fix SSL write error handling
...
Fix an use-after-free bug in the TLS implementation.
If we return from `DoWrite()` with an early error, we should
not be storing the `WriteWrap` object and complete it
again at a later point, when it has already been freed
(because of the write error).
This issue was reported by Jordan Zebor at F5 Networks,
who also helped with investigating this bug and coming
up with a reproduction.
This fixes CVE-2018-7162.
Fixes: https://github.com/nodejs-private/security/issues/189
PR-URL: https://github.com/nodejs-private/node-private/pull/127
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-06-12 05:16:55 -05:00
cjihrig
92d7b6c9a0
fs: fix promises reads with pos > 4GB
...
PR-URL: https://github.com/nodejs/node/pull/21148
Fixes: https://github.com/nodejs/node/issues/21121
Refs: https://github.com/nodejs/node/pull/21003
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-06-12 05:07:16 -05:00