Skip to content

Commit

Permalink
build: disable V8 untrusted code mitigations
Browse files Browse the repository at this point in the history
Refs: https://github.com/v8/v8/wiki/Untrusted-code-mitigations

PR-URL: #19222
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
  • Loading branch information
targos committed Mar 15, 2018
1 parent cac4da0 commit c6ae8a2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
# Don't bake anything extra into the snapshot.
'v8_use_external_startup_data%': 0,

# Disable V8 untrusted code mitigations.
# See https://github.com/v8/v8/wiki/Untrusted-code-mitigations
'v8_untrusted_code_mitigations': 'false',

# Some STL containers (e.g. std::vector) do not preserve ABI compatibility
# between debug and non-debug mode.
'disable_glibcxx_debug': 1,
Expand Down
18 changes: 18 additions & 0 deletions test/parallel/test-v8-untrusted-code-mitigations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

require('../common');
const assert = require('assert');
const { execFileSync } = require('child_process');

// This test checks that untrusted code mitigations in V8 are disabled
// by default.

const v8Options = execFileSync(process.execPath, ['--v8-options']).toString();

const untrustedFlag = v8Options.indexOf('--untrusted-code-mitigations');
assert.notStrictEqual(untrustedFlag, -1);

const nextFlag = v8Options.indexOf('--', untrustedFlag + 2);
const slice = v8Options.substring(untrustedFlag, nextFlag);

assert(slice.match(/type: bool default: false/));

0 comments on commit c6ae8a2

Please sign in to comment.