Commit ae5de618 authored by Mircea Trofin's avatar Mircea Trofin Committed by Commit Bot

[d8] enable os.system only when requested

os.system uses fork(), which is not supported by ASAN/LSAN. Some fuzz tests
consist of js code that randomly picks properties and functions and calls them.
Sometimes, this combination means ASAN will report false positives.

Bug: chromium:740361
Change-Id: Id8d517263251a1fe88abadd33b0225c664b00498
Reviewed-on: https://chromium-review.googlesource.com/580313Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46876}
parent 0392eb20
......@@ -749,9 +749,11 @@ void Shell::UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args) {
void Shell::AddOSMethods(Isolate* isolate, Local<ObjectTemplate> os_templ) {
os_templ->Set(String::NewFromUtf8(isolate, "system", NewStringType::kNormal)
.ToLocalChecked(),
FunctionTemplate::New(isolate, System));
if (options.enable_os_system) {
os_templ->Set(String::NewFromUtf8(isolate, "system", NewStringType::kNormal)
.ToLocalChecked(),
FunctionTemplate::New(isolate, System));
}
os_templ->Set(String::NewFromUtf8(isolate, "chdir", NewStringType::kNormal)
.ToLocalChecked(),
FunctionTemplate::New(isolate, ChangeDirectory));
......
// Copyright 2012 the V8 project authors. All rights reserved.
/// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -2717,6 +2717,9 @@ bool Shell::SetOptions(int argc, char* argv[]) {
} else if (strcmp(argv[i], "--disable-in-process-stack-traces") == 0) {
options.disable_in_process_stack_traces = true;
argv[i] = NULL;
} else if (strcmp(argv[i], "--enable-os-system") == 0) {
options.enable_os_system = true;
argv[i] = NULL;
}
}
......
......@@ -337,6 +337,7 @@ class ShellOptions {
const char* trace_config;
const char* lcov_file;
bool disable_in_process_stack_traces;
bool enable_os_system = false;
};
class Shell : public i::AllStatic {
......
......@@ -33,7 +33,8 @@ if [ ! -x "$d8_exec" ]; then
fi
# nm spits out 'no symbols found' messages to stderr.
cat $log_file | $d8_exec $tools_path/splaytree.js $tools_path/codemap.js \
cat $log_file | $d8_exec --enable-os-system \
$tools_path/splaytree.js $tools_path/codemap.js \
$tools_path/csvparser.js $tools_path/consarray.js \
$tools_path/profile.js $tools_path/profile_view.js \
$tools_path/logreader.js $tools_path/tickprocessor.js \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment