Skip to content

Commit 9b1cb9d

Browse files
rvaggBridgeAR
authored andcommitted
build: enable v8's siphash for hash seed creation
Triggers the V8_USE_SIPHASH to switch from the internal custom V8 hash seed generation function to an implementation of SipHash. Final step needed to clear up HashWick. PR-URL: #26367 Refs: #23259 Refs: https://darksi.de/12.hashwick-v8-vulnerability/ Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
1 parent 2c55282 commit 9b1cb9d

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

common.gypi

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
# Increment by one for each non-official patch applied to deps/v8.
3333
'v8_embedder_string': '-node.18',
3434

35+
# Turn on SipHash for hash seed generation, addresses HashWick
36+
'v8_use_siphash': 'true',
37+
3538
# Enable disassembler for `--print-code` v8 options
3639
'v8_enable_disassembler': 1,
3740

configure.py

+6
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,11 @@
509509
dest='without_snapshot',
510510
help=optparse.SUPPRESS_HELP)
511511

512+
parser.add_option('--without-siphash',
513+
action='store_true',
514+
dest='without_siphash',
515+
help=optparse.SUPPRESS_HELP)
516+
512517
parser.add_option('--code-cache-path',
513518
action='store',
514519
dest='code_cache_path',
@@ -1178,6 +1183,7 @@ def configure_v8(o):
11781183
o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
11791184
o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks.
11801185
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'
1186+
o['variables']['v8_use_siphash'] = 'false' if options.without_siphash else 'true'
11811187
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
11821188
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
11831189
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)

deps/v8/gypfiles/features.gypi

+3
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@
154154
['v8_use_snapshot=="true" and v8_use_external_startup_data==1', {
155155
'defines': ['V8_USE_EXTERNAL_STARTUP_DATA',],
156156
}],
157+
['v8_use_siphash=="true"', {
158+
'defines': ['V8_USE_SIPHASH',],
159+
}],
157160
['dcheck_always_on!=0', {
158161
'defines': ['DEBUG',],
159162
}],

deps/v8/gypfiles/v8.gyp

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
'v8_enable_verify_predictable=<(v8_enable_verify_predictable)',
9393
'v8_target_cpu=<(v8_target_arch)',
9494
'v8_use_snapshot=<(v8_use_snapshot)',
95+
'v8_use_siphash=<(v8_use_siphash)',
9596
]
9697
},
9798
'conditions': [
@@ -1432,6 +1433,8 @@
14321433
'../src/string-stream.h',
14331434
'../src/strtod.cc',
14341435
'../src/strtod.h',
1436+
'../src/third_party/siphash/halfsiphash.cc',
1437+
'../src/third_party/siphash/halfsiphash.h',
14351438
'../src/third_party/utf8-decoder/utf8-decoder.h',
14361439
'../src/tracing/trace-event.cc',
14371440
'../src/tracing/trace-event.h',

node.gyp

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
'variables': {
33
'v8_use_snapshot%': 'false',
4+
'v8_use_siphash%': 'true',
45
'v8_trace_maps%': 0,
56
'node_use_dtrace%': 'false',
67
'node_use_etw%': 'false',

0 commit comments

Comments
 (0)