The binary tarball target only codesigns bin/node. Notarization runs
only for the pkg, and tools/osx-notarize.sh only knows how to submit a
pkg, so every darwin tarball binary ships signed but without a ticket.
Gatekeeper then applies a full trust evaluation to each process spawned
through it, which slows down every CLI shim on macOS.
Make tools/osx-notarize.sh take a path instead of a version id. A .pkg
keeps the existing flow. Any other file is treated as a Mach-O binary:
it is zipped with ditto, submitted with notarytool, and the ticket is
verified with `codesign --verify -R=notarized` using the existing retry
helper. spctl cannot be used for that check, it rejects command line
tools as "not an app". The binary itself is not modified, so published
checksums do not change. A bare version id is still accepted and
resolved to node-<version>.pkg for the release branches.
Call the script from the binary target after codesign. It is a no-op
unless the NOTARIZATION_* variables are exported, so the tarball jobs
keep behaving as today until the release job injects them.
Refs: https://github.com/nodejs/node/issues/67140
Refs: https://github.com/nodejs/build/issues/3538
Refs: https://github.com/nodejs/build/issues/4545
Refs: https://github.com/nodejs/node/pull/66855
Assisted-by: Claude
Assisted-by: Codex
Signed-off-by: Ulises Gascon <ulisesgascongonzalez@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67143
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Stewart X Addison <sxa@redhat.com>
The pbkdf2() call that keeps the only threadpool worker busy used a
6-byte password and a 4-byte salt. OpenSSL 4 FIPS rejects those, so
the derivation failed at once and freed the worker. The queued stat
could then start before req.cancel() ran, and it completed without
ECANCELED.
Use inputs that meet the FIPS minimums and check that the derivation
succeeds.
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67449
Refs: https://github.com/nodejs/node/pull/67248
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
A JavaScript number is always bound with sqlite3_bind_double(), so it is
written as REAL even when it has no fractional part. A BigInt is bound
with sqlite3_bind_int64() and is the way to write an INTEGER. The type
conversion table listed number under both INTEGER and REAL without
saying which applies when, so the rule had to be discovered by
experiment.
Column type affinity hides this most of the time, which is why the cases
it does not cover are surprising. Comparing against a TEXT column is the
worst of them: the number 3 compares as '3.0' and silently fails to
match a stored '3', with no error to point at the cause. Document the
rule, the reason for it, and that case, and remove number from the
table's INTEGER row. Point the virtual table section's link at the new
text.
better-sqlite3 binds numbers the same way and has fielded the same
question repeatedly (WiseLibs/better-sqlite3#165, #627, #897, #1144,
#1313), each time closed as working as intended.
Fixes: https://github.com/nodejs/node/issues/63826
Refs: https://github.com/WiseLibs/better-sqlite3/issues/627
Assisted-by: Claude Opus 5.5
Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67424
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Add --test-forbid-only and the forbidOnly run() option to detect
accidentally committed exclusive tests. Reject only declarations and
runOnly(true) in both isolation modes, and record a run-level failure
so TODO and expected failures cannot absorb the error.
Document the runtime-only detection and add regression coverage for
filtering, option inheritance, both isolation modes, and disabled
guards.
Refs: https://github.com/nodejs/node/issues/60917
Assisted-by: a coding agent
Signed-off-by: João Victor <joao.oliveira@softtor.com.br>
PR-URL: https://github.com/nodejs/node/pull/66578
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Original commit message:
[heap] Treat zero allocation throughput as a low allocation rate
Since https://crrev.com/c/5935313 allocation throughput is tracked with
SmoothedBytesAndDuration, which has no lower bound. A sampled throughput
of exactly 0 -- nothing was allocated, or the smoothed value decayed to
0 after a long idle period -- made ComputeMutatorUtilizationImpl()
return a mutator utilization of 0 ("maximal allocation"). For an isolate
that never allocates on the CppHeap, HasLowAllocationRate() is then
never true and the MemoryReducer cannot start a GC through its
low-allocation condition; only the 100s watchdog can. Node.js hits this
for any process that does not use node:vm.
Remove the special case. A mutator speed of 0 now yields a mutator
utilization of 1, i.e. the lowest possible allocation rate. gc_speed is
either the conservative default or at least 1 byte/ms, so the formula
stays well defined.
Bug: 570738027
Change-Id: I84cd51607df3c31c2f1e02bb2fe258e5506131ce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8521518
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110599}
Refs: https://github.com/v8/v8/commit/2444c109f4f8165024971e15b12eb4611b4cd676
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66736
Original commit message:
[riscv]Fix unordered FP comparison and emit at the consumer
The lowering for kFloatLessThanOrUnordered and
kFloatLessThanOrEqualOrUnordered incorrectly mapped to (LT, true)
and (LE, true), respectively. Since ComputeBranchInfo can negate a
branch condition after emitting the comparison, complementary
conditions must use the same comparison and invert its predicate.
The incorrect mappings dropped the negation, breaking NaN semantics.
For example, optimized Wasm loops like
`do { x += 1.0; } while (!(x > 0.0));` produced wrong results.
Fix the mappings: kFloatLessThanOrUnordered now uses negated GE,
and kFloatLessThanOrEqualOrUnordered uses negated GT. To prevent
this class of bug, also convert kRiscvCmpS and kRiscvCmpD into
pseudo-instructions like the integer kRiscvCmp. The actual
comparison is now emitted at the single flags consumer (branch,
boolean materialization, or select) through the new EmitFPCompare
helper, using the consumer's final FlagsCondition. This ensures
the predicate and machine condition are resolved consistently.
Generated code remains byte-identical.
Bug: 557938134
Change-Id: I230e181753c5e9c6e7fbea651e551192a76e4005
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8360836
Reviewed-by: Ji Qiu <qiuji@iscas.ac.cn>
Auto-Submit: Yahan Lu (LuYahan) <yahan@iscas.ac.cn>
Commit-Queue: Ji Qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#109690}
Refs: https://github.com/v8/v8/commit/8521e2e77535a5c255d15ff8deb459fc7260c54d
Co-authored-by: LuYahan <yahan@iscas.ac.cn>
PR-URL: https://github.com/nodejs/node/pull/65898
Reviewed-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Original commit message:
[regexp] Reset flags between negative lookaround branches
e540e1161b0 (bug 510487690) reset the analysis-time flags between the
alternatives of a ChoiceNode, since an alternative's sub-graph may
contain a MODIFY_FLAGS node. NegativeLookaroundChoiceNode has its own
visitor and was left out, so a modifier group inside a negative
lookaround still leaks its flags into the continuation.
/(?!(?i:x|y))[K]/.exec('kz') // "k", should be null
The lookaround body is visited first and leaves the group's flags
behind; the continuation's class ranges are then made case independent
under those flags rather than the pattern's, so [K] picks up 'k'.
Only class ranges are affected: TextNode::MakeCaseIndependent
materializes the equivalents during analysis, while atoms get their case
closure at emission time from the restored flags. A single- alternative
body does not reproduce either, since its restore node is emitted last.
Change-Id: I4077076b9dbee6acf75918a2c4f7bf7d86cab059
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8175612
Auto-Submit: Jakob Linke <jgruber@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#109043}
Refs: https://github.com/v8/v8/commit/1e7ee91de77500f9905ebbc5bed33c2186b1e871
Co-authored-by: Radu Samson <radu.samson@ext.ec.europa.eu>
Refs: https://github.com/nodejs/node/issues/66277
PR-URL: https://github.com/nodejs/node/pull/67207
Reviewed-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Original commit message:
[regexp] Reset compiler flags between word boundary branches
When compiling \b and \B word boundary checks in AssertionNode where the
succeeding character type is unknown, two code paths (before_non_word and
before_word) are generated sequentially.
If the boundary assertion is placed inside a modifier group (e.g.
(?i:\.|\bNULL)), emitting the first branch traverses through on_success
and reaches the ActionNode that restores outer flags at group exit.
This mutates flags without restoring it when returning to emit the
second branch. Consequently, subsequent nodes in the second branch
(before_word) were incorrectly compiled with outer flags instead
of the modifier group's flags.
This CL saves compiler->flags() and restores them before emitting the
before_word branch in AssertionNode::EmitBoundaryCheck.
TAG=agy
Fixed: 544575761
Change-Id: I7f08bcb99c749d5e22636c8bd6eb44bd1d3e2e39
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8257209
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#109236}
Refs: https://github.com/v8/v8/commit/d315af3d83cfe3bc1709f5b140db393db42790b3
Refs: https://github.com/nodejs/node/issues/66277
PR-URL: https://github.com/nodejs/node/pull/67207
Reviewed-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Original commit message:
PPC: Fix safepoint record
This patch is needed after http://crrev.com/c/7899697 started failing
this test intermittently during GC on pntr compressed debug builds:
```
=== mjsunit/compiler/regress-crbug-1464516 ===
--- stderr ---
#
# Fatal error in ../../src/objects/tagged-impl.h, line 138
# Debug check failed: kCanBeWeak || (!IsSmi() == HAS_STRONG_HEAP_OBJECT_TAG(ptr_)).
```
PPC could emit a trampoline pool right after `MacroAssembler::Call`
returns which could make any subsequent `DefineSafepoint` calls
record the incorrect `pc_offset` as it then points to after the emitted pool.
This CL patches every "MacroAssembler::Call" site to record the pc_offset before the trampoline pool is emitted similar to how it's
done on riscv.
It's essentially porting the following changes to PPC:
f385232a87a46af77c97e9095c8a25e559c37ce7
2c6618f2d927a91dd54727abf096828521f7439f
Change-Id: I2095bce8b69b0c4f064117ed95ee2f3245436e62
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7918866
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: John <junyan1@ibm.com>
Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
Cr-Commit-Position: refs/heads/main@{#107921}
Refs: https://github.com/v8/v8/commit/f331137d5968b4665485eb20de618093a8b17d82
PR-URL: https://github.com/nodejs/node/pull/67261
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Original commit message:
[heap] Always decrement age in RetainMaps()
When the prototype and constructor were already marked we did not
age the map because of the assumption that this would only keep the
transition tree alive. However, this does not hold because of
the JSFunctions inside an AccessorPair in DescriptorArray.
This can result in retaining maps indefinitely when not triggering
memory reducing GCs. This CL therefore simplifies the code to
always age maps instead. This is neutral on Speedometer and Jetstream.
Bug: 571157135
Change-Id: I8fb633a0ec0c1d66e4596390ca48e1c7006c9cc2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8557820
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110622}
Refs: https://github.com/v8/v8/commit/497c2e6a2434af02b44417b55b1576702922f5e9
PR-URL: https://github.com/nodejs/node/pull/66728
Reviewed-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Every HMAC context was created with EVP_MAC_fetch() and keyed with the
digest passed by name, so the provider fetched the digest again on
each init. Both lookups go through OpenSSL's method store.
Keep an HMAC context without a key for each digest in the
per-Environment digest cache, and duplicate it in createHmac(). A
duplicated context already has its digest, so keying it with the same
digest no longer fetches anything.
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Assisted-by: Grok
PR-URL: https://github.com/nodejs/node/pull/67109
Backport-PR-URL: https://github.com/nodejs/node/pull/67442
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
createHmac(), createSign(), createVerify() and the synchronous
one-shot sign, verify, HKDF and PBKDF2 functions looked up their
digest with Digest::FromName(). That returns OpenSSL's legacy EVP_MD,
so every EVP_DigestInit_ex() and HMAC init had to fetch the provider
implementation again through the method store.
Look these digests up through the per-Environment cache that
createHash() and crypto.hash() already use. Jobs on the thread pool
keep using Digest::FromName(): with the cache, Web Crypto digest and
HMAC throughput went down, because workers that finish sooner have to
be woken up for each new job more often.
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Assisted-by: Grok
PR-URL: https://github.com/nodejs/node/pull/67109
Backport-PR-URL: https://github.com/nodejs/node/pull/67442
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Explicit DH parameters are recognized as named groups during OpenSSL
provider import, but DHPointer::check() only skips primality checks for
groups constructed by name. This makes createDiffieHellman() block for
seconds on standard MODP groups.
Query the imported key's group name to restore the legacy DH_check()
shortcut without changing key generation. Add a deterministic regression
test with randomness disabled and cover explicit and padded parameters
through the JavaScript API.
Fixes: https://github.com/nodejs/node/issues/67067
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67071
Backport-PR-URL: https://github.com/nodejs/node/pull/67442
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Expose version, subjectName, issuerName, extensions, tbs, and signature
without requiring callers to parse display strings or certificate DER.
Names include complete DER and grouped, ordered RDN attributes.
Extensions retain their order, duplicate and unknown OIDs, criticality,
and raw values. Expose the exact signed TBSCertificate bytes and the
signature octets, algorithm OID, and DER parameters.
Return fresh objects, arrays, and Buffers from the new getters, leaving
existing getter caching unchanged. Report inspection failures as
ERR_CRYPTO_INVALID_X509_CERTIFICATE.
Fixes: https://github.com/nodejs/node/issues/48730
Assisted-by: Codex
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67082
Backport-PR-URL: https://github.com/nodejs/node/pull/67442
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
X509View::isIssuedBy() clears the caller's OpenSSL error queue on
entry and exit, including when either certificate is missing.
Use a mark/pop scope to discard errors from the issuer check without
losing earlier diagnostics. Cover successful checks, mismatches,
malformed extensions, and null inputs with empty and populated queues.
Assisted-by: Codex
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66898
Backport-PR-URL: https://github.com/nodejs/node/pull/67442
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
On Linux an addon or FFI library inside a VFS is loaded from an
anonymous memfd through /proc/self/fd/N, and the memfd was closed
right after a successful load. The next image then got the same fd
number, hence the same path, and the dynamic loader, which knows a
loaded object by the path it was opened with, returned the object
already loaded under that path instead of loading the new file. So
the second of any two addons or libraries loaded from a VFS resolved
to the first: an addon after an FFI library failed with "Module did
not self-register", an FFI library after an addon had none of its
own symbols, and two addons silently became the same one.
The fd is only needed until dlopen() returns, as the load's mapping
keeps the memory alive from then on; what must not be shared is the
path. Before the load, ask the loader with RTLD_NOLOAD whether the
path is already taken, and if so move the fd to a higher number with
F_DUPFD_CLOEXEC until it is free. Holding the fd from the check
through the load keeps anyone else from taking the path in between,
so this needs neither a counter nor a lock, and a library that has
really been unloaded gives its number back. The fd is closed right
after the load, whether or not it worked. Should no free number be
left, the image goes to a temp file.
The leak checks of test-vfs-addon and test-ffi-vfs compared the shared
temporary directory before and after the load, so off Linux any other
test loading from bytes at the same time could pass for a leak. Point
TMPDIR at a directory each test owns instead.
Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
PR-URL: https://github.com/nodejs/node/pull/67068
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>