node/test/pummel
Joyee Cheung af5c144ebc
deps,build,test: fix array index hash collision
This enables v8_enable_seeded_array_index_hash and add a test for it.

Fixes: https://hackerone.com/reports/3511792

deps: V8: backport 0a8b1cdcc8b2

Original commit message:

    implement rapidhash secret generation

    Bug: 409717082
    Change-Id: I471f33d66de32002f744aeba534c1d34f71e27d2
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6733490
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: snek <snek@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#101499}

Refs: 0a8b1cdcc8
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>

deps: V8: backport 185f0fe09b72

Original commit message:

    [numbers] Refactor HashSeed as a lightweight view over ByteArray

    Instead of copying the seed and secrets into a struct with value
    fields, HashSeed now stores a pointer pointing either into the
    read-only ByteArray, or the static default seed for off-heap
    HashSeed::Default() calls. The underlying storage is always
    8-byte aligned so we can cast it directly into a struct.

    Change-Id: I5896a7f2ae24296eb4c80b757a5d90ac70a34866
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7609720
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/main@{#105531}

Refs: 185f0fe09b
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>

deps: V8: backport 1361b2a49d02

Original commit message:

    [strings] improve array index hash distribution

    Previously, the hashes stored in a Name's raw_hash_field for decimal
    numeric strings (potential array indices) consist of the literal
    integer value along with the length of the string. This means
    consecutive numeric strings can have consecutive hash values, which
    can lead to O(n^2) probing for insertion in the worst case when e.g.
    a non-numeric string happen to land in the these buckets.

    This patch adds a build-time flag v8_enable_seeded_array_index_hash that
    scrambles the 24-bit array-index value stored in a Name's raw_hash_field
    to improve the distribution.

    x ^= x >> kShift; x = (x * m1) & kMask;    // round 1
    x ^= x >> kShift; x = (x * m2) & kMask;    // round 2
    x ^= x >> kShift;                          // finalize

    To decode, apply the same steps with the modular inverses of m1 and m2
    in reverse order.

    x ^= x >> kShift; x = (x * m2_inv) & kMask;    // round 1
    x ^= x >> kShift; x = (x * m1_inv) & kMask;    // round 2
    x ^= x >> kShift;                              // finalize

    where kShift = kArrayIndexValueBits / 2, kMask = kArrayIndexValueMask,
    m1, m2 (both odd) are the lower bits of the rapidhash secrets, m1_inv,
    m2_inv (modular inverses) are precomputed modular inverse of m1 and m2.
    The pre-computed values are appended to the hash_seed ByteArray in
    ReadOnlyRoots and accessed in generated code to reduce overhead.
    In call sites that don't already have access to the seeds, we read them
    from the current isolate group/isolate's read only roots.

    To consolidate the code that encode/decode these hashes, this patch
    adds MakeArrayIndexHash/DecodeArrayIndexFromHashField in C++ and CSA
    that perform seeding/unseeding if enabled, and updates places where
    encoding/decoding of array index is needed to use them.

    Bug: 477515021
    Change-Id: I350afe511951a54c4378396538152cc56565fd55
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7564330
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/main@{#105596}

Refs: 1361b2a49d
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>

deps: V8: cherry-pick aac14dd95e5b

Original commit message:

    [string] add 3rd round to seeded array index hash

    Since we already have 3 derived secrets, and arithmetics are
    relatively cheap, add a 3rd round to the xorshift-multiply
    seeding scheme. This brings the bias from ~3.4 to ~0.4.

    Bug: 477515021
    Change-Id: I1ef48954bcee8768d8c90db06ac8adb02f06cebf
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7655117
    Reviewed-by: Chengzhong Wu <cwu631@bloomberg.net>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#105824}

Refs: aac14dd95e
PR-URL: https://github.com/nodejs-private/node-private/pull/834
CVE-ID: CVE-2026-21717
2026-03-23 18:45:35 +01:00
..
pummel.status Revert "test: mark test-fs-watch-non-recursive flaky on Windows" 2024-11-17 11:51:38 +01:00
test-array-hash-collision.js deps,build,test: fix array index hash collision 2026-03-23 18:45:35 +01:00
test-blob-slice-with-large-size.js test: fix missing edge case in test-blob-slice-with-large-size 2025-06-05 08:56:40 +02:00
test-child-process-spawn-loop.js test: use python3 instead of python in pummel test 2024-08-19 10:32:29 +02:00
test-crypto-dh-hash.js
test-crypto-dh-keys.js
test-dh-regr.js
test-fs-largefile.js
test-fs-read-file-sync-utf8-memory.js fs: added test for missing call to uv_fs_req_cleanup 2025-05-12 12:38:47 -03:00
test-fs-readfile-tostring-fail.js
test-fs-watch-file-slow.js
test-fs-watch-file.js
test-fs-watch-non-recursive.js test: refactor fs-watch tests due to macOS issue 2024-10-02 07:57:54 +02:00
test-fs-watch-system-limit.js
test-hash-seed.js
test-heapdump-dns.js
test-heapdump-env.js
test-heapdump-fs-promise.js
test-heapdump-http2.js
test-heapdump-inspector.js
test-heapdump-shadow-realm.js
test-heapdump-tls.js
test-heapdump-worker.js
test-heapdump-zlib.js
test-heapsnapshot-near-heap-limit-big.js
test-heapsnapshot-near-heap-limit-bounded.js
test-heapsnapshot-near-heap-limit-by-api.js
test-heapsnapshot-near-heap-limit.js
test-http-many-keep-alive-connections.js
test-http-upload-timeout.js
test-https-large-response.js
test-https-no-reader.js
test-keep-alive.js
test-net-many-clients.js
test-net-pause.js
test-net-pingpong-delay.js
test-net-pingpong.js
test-net-timeout.js
test-net-timeout2.js
test-net-write-callbacks.js
test-next-tick-infinite-calls.js
test-policy-integrity-dep.js
test-policy-integrity-parent-commonjs.js
test-policy-integrity-parent-module.js
test-policy-integrity-parent-no-package-json.js
test-policy-integrity-worker-commonjs.js
test-policy-integrity-worker-module.js
test-policy-integrity-worker-no-package-json.js
test-process-cpuUsage.js
test-process-hrtime.js
test-regress-GH-892.js
test-stream-pipe-multi.js
test-string-decoder-large-buffer.js
test-timers.js test: deflake test/pummel/test-timers.js 2024-11-17 11:51:40 +01:00
test-tls-server-large-request.js
test-tls-throttle.js
test-vm-memleak.js
test-vm-race.js
test-watch-file.js
test-webcrypto-derivebits-pbkdf2.js crypto: allow length=0 for HKDF and PBKDF2 in SubtleCrypto.deriveBits 2025-06-11 09:21:24 +02:00
test-worker-take-heapsnapshot.js
testcfg.py