Skip to content

Commit c58d762

Browse files
codebytereaduh95
authored andcommitted
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 <shelley.vohr@gmail.com> PR-URL: #62237 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent ade523a commit c58d762

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

configure.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@
872872
action='store_true',
873873
dest='pointer_compression_shared_cage',
874874
default=None,
875-
help='[Experimental] Use V8 pointer compression with shared cage (requires --experimental-enable-pointer-compression)')
875+
help='[Experimental] Use V8 pointer compression with a shared cage and enable the V8 sandbox (requires --experimental-enable-pointer-compression)')
876876

877877
parser.add_argument('--v8-options',
878878
action='store',
@@ -2214,16 +2214,10 @@ def configure_v8(o, configs):
22142214
flavor not in ('aix', 'os400', 'zos') and
22152215
o['variables']['target_arch'] in maglev_enabled_architectures)
22162216
o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0
2217-
# Using the sandbox requires always allocating array buffer backing stores in the sandbox.
2218-
# We currently have many backing stores tied to pointers from C++ land that are not
2219-
# even necessarily dynamic (e.g. in static storage) for fast communication between JS and C++.
2220-
# Until we manage to get rid of all those, v8_enable_sandbox cannot be used.
2221-
# Note that enabling pointer compression without enabling sandbox is unsupported by V8,
2222-
# so this can be broken at any time.
2223-
o['variables']['v8_enable_sandbox'] = 0
2224-
# We set v8_enable_pointer_compression_shared_cage to 0 always, even when
2225-
# pointer compression is enabled so that we don't accidentally enable shared
2226-
# cage mode when pointer compression is on.
2217+
# Like V8's own default, the sandbox goes with the shared pointer compression
2218+
# cage. Multi-cage builds give every IsolateGroup its own sandbox, which the
2219+
# array buffer allocator does not know about yet.
2220+
o['variables']['v8_enable_sandbox'] = 1 if options.pointer_compression_shared_cage else 0
22272221
o['variables']['v8_enable_pointer_compression_shared_cage'] = 1 if options.pointer_compression_shared_cage else 0
22282222
o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0
22292223
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0

0 commit comments

Comments
 (0)