From 4b23a4472ce8da19e48d490bd3fe4bc4caaec753 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 21 Aug 2026 12:42:35 +0000 Subject: [PATCH] build: enable the V8 sandbox in shared-cage builds V8 defaults `v8_enable_sandbox` to on whenever the shared pointer compression cage and the external code space are enabled, and that is the configuration embedders that use the sandbox build with. Now that the sandbox builds and passes the tests, follow that default for `--experimental-pointer-compression-shared-cage` so the configuration is reachable from `configure`. Multi-cage pointer compression builds stay without it: there every IsolateGroup gets its own sandbox, and `NodeArrayBufferAllocator` always allocates from the default one. Signed-off-by: Shelley Vohr PR-URL: https://github.com/nodejs/node/pull/62237 Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu --- configure.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/configure.py b/configure.py index 633262f9ca8..b826e24e3f4 100755 --- a/configure.py +++ b/configure.py @@ -754,7 +754,7 @@ parser.add_argument('--experimental-pointer-compression-shared-cage', action='store_true', dest='pointer_compression_shared_cage', default=None, - help='[Experimental] Use V8 pointer compression with shared cage (requires --experimental-enable-pointer-compression)') + help='[Experimental] Use V8 pointer compression with a shared cage and enable the V8 sandbox (requires --experimental-enable-pointer-compression)') parser.add_argument('--v8-options', action='store', @@ -1952,16 +1952,10 @@ def configure_v8(o, configs): o['variables']['v8_enable_maglev'] = B(not options.v8_disable_maglev and o['variables']['target_arch'] in maglev_enabled_architectures) o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0 - # Using the sandbox requires always allocating array buffer backing stores in the sandbox. - # We currently have many backing stores tied to pointers from C++ land that are not - # even necessarily dynamic (e.g. in static storage) for fast communication between JS and C++. - # Until we manage to get rid of all those, v8_enable_sandbox cannot be used. - # Note that enabling pointer compression without enabling sandbox is unsupported by V8, - # so this can be broken at any time. - o['variables']['v8_enable_sandbox'] = 0 - # We set v8_enable_pointer_compression_shared_cage to 0 always, even when - # pointer compression is enabled so that we don't accidentally enable shared - # cage mode when pointer compression is on. + # Like V8's own default, the sandbox goes with the shared pointer compression + # cage. Multi-cage builds give every IsolateGroup its own sandbox, which the + # array buffer allocator does not know about yet. + o['variables']['v8_enable_sandbox'] = 1 if options.pointer_compression_shared_cage else 0 o['variables']['v8_enable_pointer_compression_shared_cage'] = 1 if options.pointer_compression_shared_cage else 0 o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0 o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0