From b282640c5353f37b706d3395718e80db244644b2 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 17 Dec 2022 21:01:15 -0600 Subject: user/node: Update to 16.19.0; fix test, NULL deref * The worker-stdio test no longer raises RangeError on 32-bit Intel. * The sigint test is no longer flaky (backported from 18 branch). * The C++ Environment handler no longer segfaults when /proc is unmounted. (Submitted upstream.) Fixes: #795 --- user/node/APKBUILD | 13 +++++-- user/node/env-nullptr-backport.patch | 28 ++++++++++++++ user/node/flaky-sigint-test.patch | 73 ++++++++++++++++++++++++++++++++++++ user/node/pmmx-test.patch | 16 ++++++++ 4 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 user/node/env-nullptr-backport.patch create mode 100644 user/node/flaky-sigint-test.patch create mode 100644 user/node/pmmx-test.patch (limited to 'user') diff --git a/user/node/APKBUILD b/user/node/APKBUILD index a658f6779..5efe427d1 100644 --- a/user/node/APKBUILD +++ b/user/node/APKBUILD @@ -1,7 +1,7 @@ # Contributor: A. Wilcox # Maintainer: A. Wilcox pkgname=node -pkgver=16.15.0 +pkgver=16.19.0 pkgrel=0 pkgdesc="JavaScript runtime" url="https://nodejs.org/" @@ -12,7 +12,11 @@ depends="" makedepends="c-ares-dev http-parser-dev icu-dev libexecinfo-dev libuv-dev nghttp2-dev openssl-dev python3 zlib-dev samurai" subpackages="$pkgname-dev $pkgname-doc" -source="https://nodejs.org/download/release/v$pkgver/node-v$pkgver.tar.xz" +source="https://nodejs.org/download/release/v$pkgver/node-v$pkgver.tar.xz + env-nullptr-backport.patch + flaky-sigint-test.patch + pmmx-test.patch + " builddir="$srcdir/$pkgname-v$pkgver" # secfixes: @@ -55,4 +59,7 @@ package() { make DESTDIR="$pkgdir" install } -sha512sums="c85cf4a94a0dccdcf358a3e0383499fe1fd74ac0e7b6aa888e9524c070ae8be68b9f718c8c0940d51115bbc908202cd7819e370507b7191facd375a5be231c69 node-v16.15.0.tar.xz" +sha512sums="cbc70067a7aefb6b8d2e238c9611fa901ddee8e9ffc3e6becddec4b156cc52da6e172b33e797265858cacbd014e0e1f0c93bd7c412a7afb436731b3fecd384a3 node-v16.19.0.tar.xz +e8374b4838256a0762b8c5448dd84fb5ac80aec0df5bb0869941288897a5084f74631e37619f0814c7fe98762e7f603a13511d68594e4f6c46ae1dd420bb61ad env-nullptr-backport.patch +9d6451871cfb4940ed5c53ae95f37761480890e2ed50cf7029f070f23b343721763b0339f77da3c61a878d65f7b2dd9a91012e62fc61e775a10a0f1d2a8ebe80 flaky-sigint-test.patch +277e226f3906f791bae6aedd0b74b0e2c52b6154eb2dc0c568417ad94a0722078e4fbbbe15c59d4ba0b59cdb4ad45b5e9620f14d75694a15531857cd29aa044a pmmx-test.patch" diff --git a/user/node/env-nullptr-backport.patch b/user/node/env-nullptr-backport.patch new file mode 100644 index 000000000..02878dc25 --- /dev/null +++ b/user/node/env-nullptr-backport.patch @@ -0,0 +1,28 @@ +From 8214cc175f0c4e600a3af5cedd94e4fd4d8d839e Mon Sep 17 00:00:00 2001 +From: "A. Wilcox" +Date: Sat, 17 Dec 2022 19:39:01 -0600 +Subject: [PATCH] env: check size of args before using for exec_path + +If we are in an artifically created Environment that has no args set, +and uv_exepath returns an error (for instance, if /proc is not mounted +on a Linux system), then we crash with a nullptr deref attempting to +use argv[0]. + +Fixes: https://github.com/nodejs/node/issues/45901 +--- + src/env.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/env.cc b/src/env.cc +index 5172d71ad6a6..97e0ac581113 100644 +--- node-v16.15.0/src/env.cc.old 2022-04-26 22:03:30.000000000 +0000 ++++ node-v16.15.0/src/env.cc 2022-12-18 01:19:23.417720353 +0000 +@@ -309,7 +309,7 @@ + std::string exec_path; + if (uv_exepath(exec_path_buf, &exec_path_len) == 0) { + exec_path = std::string(exec_path_buf, exec_path_len); +- } else { ++ } else if (argv.size() > 0) { + exec_path = argv[0]; + } + diff --git a/user/node/flaky-sigint-test.patch b/user/node/flaky-sigint-test.patch new file mode 100644 index 000000000..0ac7a49b1 --- /dev/null +++ b/user/node/flaky-sigint-test.patch @@ -0,0 +1,73 @@ +From 80ade7f46f3cd6b969153dbfc34c451fc624bdc6 Mon Sep 17 00:00:00 2001 +From: Rich Trott +Date: Sun, 6 Nov 2022 22:41:28 -0800 +Subject: [PATCH 1/2] test: fix flaky test-repl-sigint-nested-eval + +There is a race condition where process.kill can be sent before the +target is ready to receive the signal. + +Fixes: https://github.com/nodejs/node/issues/41123 +--- + test/parallel/test-repl-sigint-nested-eval.js | 12 +++++++----- + 1 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/test/parallel/test-repl-sigint-nested-eval.js b/test/parallel/test-repl-sigint-nested-eval.js +index 28e4d44b235c..5830e08629b9 100644 +--- a/test/parallel/test-repl-sigint-nested-eval.js ++++ b/test/parallel/test-repl-sigint-nested-eval.js +@@ -12,7 +12,7 @@ const spawn = require('child_process').spawn; + + process.env.REPL_TEST_PPID = process.pid; + const child = spawn(process.execPath, [ '-i' ], { +- stdio: [null, null, 2] ++ stdio: [null, null, 2, 'ipc'] + }); + + let stdout = ''; +@@ -22,7 +22,8 @@ child.stdout.on('data', function(c) { + }); + + child.stdout.once('data', common.mustCall(() => { +- process.on('SIGUSR2', common.mustCall(() => { ++ child.on('message', common.mustCall((msg) => { ++ assert.strictEqual(msg, 'repl is busy'); + process.kill(child.pid, 'SIGINT'); + child.stdout.once('data', common.mustCall(() => { + // Make sure REPL still works. +@@ -30,9 +31,10 @@ child.stdout.once('data', common.mustCall(() => { + })); + })); + +- child.stdin.write('process.kill(+process.env.REPL_TEST_PPID, "SIGUSR2");' + +- 'vm.runInThisContext("while(true){}", ' + +- '{ breakOnSigint: true });\n'); ++ child.stdin.write( ++ 'vm.runInThisContext("process.send(\'repl is busy\'); while(true){}", ' + ++ '{ breakOnSigint: true });\n' ++ ); + })); + + child.on('close', function(code) { + +From 2d9cf095d12420ef825e9ba83deb46426561ddbb Mon Sep 17 00:00:00 2001 +From: Rich Trott +Date: Thu, 10 Nov 2022 09:00:55 -0800 +Subject: [PATCH 2/2] Update test/parallel/test-repl-sigint-nested-eval.js + +Co-authored-by: Antoine du Hamel +--- + test/parallel/test-repl-sigint-nested-eval.js | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/test/parallel/test-repl-sigint-nested-eval.js b/test/parallel/test-repl-sigint-nested-eval.js +index 5830e08629b9..62eb46e0af67 100644 +--- a/test/parallel/test-repl-sigint-nested-eval.js ++++ b/test/parallel/test-repl-sigint-nested-eval.js +@@ -10,7 +10,6 @@ if (!common.isMainThread) + const assert = require('assert'); + const spawn = require('child_process').spawn; + +-process.env.REPL_TEST_PPID = process.pid; + const child = spawn(process.execPath, [ '-i' ], { + stdio: [null, null, 2, 'ipc'] + }); diff --git a/user/node/pmmx-test.patch b/user/node/pmmx-test.patch new file mode 100644 index 000000000..aad874a90 --- /dev/null +++ b/user/node/pmmx-test.patch @@ -0,0 +1,16 @@ +The pmmx Node binary is too large to read entirely into js memory. + +Issue: #795 +See-Also: https://bugzilla.opensuse.org/show_bug.cgi?id=1183155 + +--- node-v16.15.0/test/parallel/test-worker-stdio.js.old 2022-04-26 22:03:31.000000000 +0000 ++++ node-v16.15.0/test/parallel/test-worker-stdio.js 2022-12-17 23:44:49.604182229 +0000 +@@ -27,7 +27,7 @@ + const passed = new BufferingWritable(); + + const w = new Worker(__filename, { stdin: true, stdout: true }); +- const source = fs.createReadStream(process.execPath); ++ const source = fs.createReadStream(process.execPath, { end: 1048576 }); + source.pipe(w.stdin); + source.pipe(original); + w.stdout.pipe(passed); -- cgit v1.2.3-60-g2f50