Commit a361f9f6 authored by Ilya Sherman's avatar Ilya Sherman Committed by Commit Bot

Update Crashpad to 10ff56eee5da29d14b86818b88a93d3e96b4bacd

05dee13e844d fuchsia: Add QEMU and helper script to start/stop instance
169731495268 fuchsia: Make Filesystem.RemoveFile, .RemoveDirectory pass
7662fb087f6c Roll mini_chromium a12ed4a6..20182dd2
344acadfdd36 [Cleanup] Rename UMA_HISTOGRAM_SPARSE_SLOWLY to
             base::UmaHistogramSparse()
10ff56eee5da Include the appropriate header for BUILD_FUSCHIA

R=mark@chromium.org

Bug: 773850
Change-Id: I649547ba3809ab836ea5d9da9fd77c9daaeff669
Reviewed-on: https://chromium-review.googlesource.com/830811Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Commit-Queue: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524486}
parent 82751a5e
...@@ -2,7 +2,7 @@ Name: Crashpad ...@@ -2,7 +2,7 @@ Name: Crashpad
Short Name: crashpad Short Name: crashpad
URL: https://crashpad.chromium.org/ URL: https://crashpad.chromium.org/
Version: unknown Version: unknown
Revision: 0924e567514fc577e725b56cd602808467b317a9 Revision: 10ff56eee5da29d14b86818b88a93d3e96b4bacd
License: Apache 2.0 License: Apache 2.0
License File: crashpad/LICENSE License File: crashpad/LICENSE
Security Critical: yes Security Critical: yes
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
/out /out
/third_party/fuchsia/.cipd /third_party/fuchsia/.cipd
/third_party/fuchsia/clang /third_party/fuchsia/clang
/third_party/fuchsia/qemu
/third_party/fuchsia/sdk /third_party/fuchsia/sdk
/third_party/gtest/gtest /third_party/gtest/gtest
/third_party/gyp/gyp /third_party/gyp/gyp
......
...@@ -28,7 +28,7 @@ deps = { ...@@ -28,7 +28,7 @@ deps = {
'5e2b3ddde7cda5eb6bc09a5546a76b00e49d888f', '5e2b3ddde7cda5eb6bc09a5546a76b00e49d888f',
'crashpad/third_party/mini_chromium/mini_chromium': 'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' + Var('chromium_git') + '/chromium/mini_chromium@' +
'a12ed4a613a7df900059c8a7885acdad550a5319', '20182dd263312db9fad52042fc92c33331ec6904',
'crashpad/third_party/zlib/zlib': 'crashpad/third_party/zlib/zlib':
Var('chromium_git') + '/chromium/src/third_party/zlib@' + Var('chromium_git') + '/chromium/src/third_party/zlib@' +
'13dc246a58e4b72104d35f9b1809af95221ebda7', '13dc246a58e4b72104d35f9b1809af95221ebda7',
...@@ -145,6 +145,36 @@ hooks = [ ...@@ -145,6 +145,36 @@ hooks = [
'-log-level', 'info', '-log-level', 'info',
], ],
}, },
{
# Same rationale for using "install" rather than "ensure" as for clang
# packages. https://crbug.com/789364.
'name': 'fuchsia_qemu_mac',
'pattern': '.',
'condition': 'checkout_fuchsia and host_os == "mac"',
'action': [
'cipd',
'install',
'fuchsia/qemu/mac-amd64',
'latest',
'-root', 'crashpad/third_party/fuchsia/qemu/mac-amd64',
'-log-level', 'info',
],
},
{
# Same rationale for using "install" rather than "ensure" as for clang
# packages. https://crbug.com/789364.
'name': 'fuchsia_qemu_linux',
'pattern': '.',
'condition': 'checkout_fuchsia and host_os == "linux"',
'action': [
'cipd',
'install',
'fuchsia/qemu/linux-amd64',
'latest',
'-root', 'crashpad/third_party/fuchsia/qemu/linux-amd64',
'-log-level', 'info',
],
},
{ {
# The SDK is keyed to the host system because it contains build tools. # The SDK is keyed to the host system because it contains build tools.
# Currently, linux-amd64 is the only SDK published (see # Currently, linux-amd64 is the only SDK published (see
......
#!/usr/bin/env python
# Copyright 2017 The Crashpad Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Helper script to [re]start or stop a helper Fuchsia QEMU instance to be used
for running tests without a device.
"""
from __future__ import print_function
import getpass
import os
import random
import signal
import subprocess
import sys
import tempfile
try:
from subprocess import DEVNULL
except ImportError:
DEVNULL = open(os.devnull, 'r+b')
CRASHPAD_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)),
os.pardir)
def _Stop(pid_file):
if os.path.isfile(pid_file):
with open(pid_file, 'rb') as f:
pid = int(f.read().strip())
try:
os.kill(pid, signal.SIGTERM)
except:
print('Unable to kill pid %d, continuing' % pid, file=sys.stderr)
os.unlink(pid_file)
def _CheckForTun():
"""Check for networking. TODO(scottmg): Currently, this is Linux-specific.
"""
returncode = subprocess.call(
['tunctl', '-b', '-u', getpass.getuser(), '-t', 'qemu'],
stdout=DEVNULL, stderr=DEVNULL)
if returncode != 0:
print('To use QEMU with networking on Linux, configure TUN/TAP. See:',
file=sys.stderr)
print(' https://fuchsia.googlesource.com/magenta/+/HEAD/docs/qemu.md#enabling-networking-under-qemu-x86_64-only',
file=sys.stderr)
return 2
return 0
def _Start(pid_file):
tun_result = _CheckForTun()
if tun_result != 0:
return tun_result
arch = 'mac-amd64' if sys.platform == 'darwin' else 'linux-amd64'
fuchsia_dir = os.path.join(CRASHPAD_ROOT, 'third_party', 'fuchsia')
qemu_path = os.path.join(fuchsia_dir, 'qemu', arch, 'bin',
'qemu-system-x86_64')
kernel_data_dir = os.path.join(fuchsia_dir, 'sdk', arch, 'target', 'x86_64')
kernel_path = os.path.join(kernel_data_dir, 'zircon.bin')
initrd_path = os.path.join(kernel_data_dir, 'bootdata.bin')
mac_tail = ':'.join('%02x' % random.randint(0, 255) for x in range(3))
# These arguments are from the Fuchsia repo in zircon/scripts/run-zircon.
popen = subprocess.Popen([
qemu_path,
'-m', '2048',
'-nographic',
'-kernel', kernel_path,
'-initrd', initrd_path,
'-smp', '4',
'-serial', 'stdio',
'-monitor', 'none',
'-machine', 'q35',
'-cpu', 'host,migratable=no',
'-enable-kvm',
'-netdev', 'type=tap,ifname=qemu,script=no,downscript=no,id=net0',
'-device', 'e1000,netdev=net0,mac=52:54:00:' + mac_tail,
'-append', 'TERM=dumb',
], stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL)
with open(pid_file, 'wb') as f:
f.write('%d\n' % popen.pid)
def main(args):
if len(args) != 1 or args[0] not in ('start', 'stop'):
print('usage: run_fuchsia_qemu.py start|stop', file=sys.stderr)
return 1
command = args[0]
pid_file = os.path.join(tempfile.gettempdir(), 'crashpad_fuchsia_qemu_pid')
_Stop(pid_file)
if command == 'start':
_Start(pid_file)
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/posix/eintr_wrapper.h" #include "base/posix/eintr_wrapper.h"
#include "build/build_config.h"
namespace crashpad { namespace crashpad {
...@@ -66,7 +67,12 @@ FileHandle OpenFileForOutput(int rdwr_or_wronly, ...@@ -66,7 +67,12 @@ FileHandle OpenFileForOutput(int rdwr_or_wronly,
const base::FilePath& path, const base::FilePath& path,
FileWriteMode mode, FileWriteMode mode,
FilePermissions permissions) { FilePermissions permissions) {
#if defined(OS_FUCHSIA)
// O_NOCTTY is invalid on Fuchsia, and O_CLOEXEC isn't necessary.
int flags = 0;
#else
int flags = O_NOCTTY | O_CLOEXEC; int flags = O_NOCTTY | O_CLOEXEC;
#endif
DCHECK(rdwr_or_wronly & (O_RDWR | O_WRONLY)); DCHECK(rdwr_or_wronly & (O_RDWR | O_WRONLY));
DCHECK_EQ(rdwr_or_wronly & ~(O_RDWR | O_WRONLY), 0); DCHECK_EQ(rdwr_or_wronly & ~(O_RDWR | O_WRONLY), 0);
......
...@@ -373,7 +373,6 @@ TEST(Filesystem, RemoveFile) { ...@@ -373,7 +373,6 @@ TEST(Filesystem, RemoveFile) {
EXPECT_FALSE(LoggingRemoveFile(base::FilePath())); EXPECT_FALSE(LoggingRemoveFile(base::FilePath()));
ScopedTempDir temp_dir; ScopedTempDir temp_dir;
EXPECT_FALSE(LoggingRemoveFile(temp_dir.path()));
base::FilePath file(temp_dir.path().Append(FILE_PATH_LITERAL("file"))); base::FilePath file(temp_dir.path().Append(FILE_PATH_LITERAL("file")));
EXPECT_FALSE(LoggingRemoveFile(file)); EXPECT_FALSE(LoggingRemoveFile(file));
...@@ -384,7 +383,6 @@ TEST(Filesystem, RemoveFile) { ...@@ -384,7 +383,6 @@ TEST(Filesystem, RemoveFile) {
base::FilePath dir(temp_dir.path().Append(FILE_PATH_LITERAL("dir"))); base::FilePath dir(temp_dir.path().Append(FILE_PATH_LITERAL("dir")));
ASSERT_TRUE( ASSERT_TRUE(
LoggingCreateDirectory(dir, FilePermissions::kWorldReadable, false)); LoggingCreateDirectory(dir, FilePermissions::kWorldReadable, false));
EXPECT_FALSE(LoggingRemoveFile(dir));
EXPECT_TRUE(LoggingRemoveFile(file)); EXPECT_TRUE(LoggingRemoveFile(file));
EXPECT_FALSE(PathExists(file)); EXPECT_FALSE(PathExists(file));
...@@ -433,8 +431,16 @@ TEST(Filesystem, RemoveDirectory) { ...@@ -433,8 +431,16 @@ TEST(Filesystem, RemoveDirectory) {
EXPECT_FALSE(LoggingRemoveDirectory(file)); EXPECT_FALSE(LoggingRemoveDirectory(file));
ASSERT_TRUE(CreateFile(file)); ASSERT_TRUE(CreateFile(file));
#if !defined(OS_FUCHSIA)
// The current implementation of Fuchsia's rmdir() simply calls unlink(), and
// unlink() works on all FS objects. This is incorrect as
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html says
// "The directory shall be removed only if it is an empty directory." and "If
// the directory is not an empty directory, rmdir() shall fail and set errno
// to [EEXIST] or [ENOTEMPTY]." Upstream bug: US-400.
EXPECT_FALSE(LoggingRemoveDirectory(file)); EXPECT_FALSE(LoggingRemoveDirectory(file));
EXPECT_FALSE(LoggingRemoveDirectory(dir)); EXPECT_FALSE(LoggingRemoveDirectory(dir));
#endif
ASSERT_TRUE(LoggingRemoveFile(file)); ASSERT_TRUE(LoggingRemoveFile(file));
EXPECT_TRUE(LoggingRemoveDirectory(dir)); EXPECT_TRUE(LoggingRemoveDirectory(dir));
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "util/misc/metrics.h" #include "util/misc/metrics.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
...@@ -91,8 +91,8 @@ void Metrics::ExceptionCaptureResult(CaptureResult result) { ...@@ -91,8 +91,8 @@ void Metrics::ExceptionCaptureResult(CaptureResult result) {
// static // static
void Metrics::ExceptionCode(uint32_t exception_code) { void Metrics::ExceptionCode(uint32_t exception_code) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Crashpad.ExceptionCode." METRICS_OS_NAME, base::UmaHistogramSparse("Crashpad.ExceptionCode." METRICS_OS_NAME,
static_cast<int32_t>(exception_code)); static_cast<int32_t>(exception_code));
} }
// static // static
...@@ -109,7 +109,7 @@ void Metrics::HandlerLifetimeMilestone(LifetimeMilestone milestone) { ...@@ -109,7 +109,7 @@ void Metrics::HandlerLifetimeMilestone(LifetimeMilestone milestone) {
// static // static
void Metrics::HandlerCrashed(uint32_t exception_code) { void Metrics::HandlerCrashed(uint32_t exception_code) {
UMA_HISTOGRAM_SPARSE_SLOWLY( base::UmaHistogramSparse(
"Crashpad.HandlerCrash.ExceptionCode." METRICS_OS_NAME, "Crashpad.HandlerCrash.ExceptionCode." METRICS_OS_NAME,
static_cast<int32_t>(exception_code)); static_cast<int32_t>(exception_code));
} }
......
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