Add lss to third_party and use sys_getpid()

More syscalls to come.

Bug: crashpad:265
Change-Id: Ib139e638b0356426f922650249632132fd613f6f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1540403
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Joshua Peraza 2019-04-08 17:28:18 -07:00 committed by Commit Bot
parent ae431a1ae5
commit cc0c2f90df
8 changed files with 115 additions and 2 deletions

3
DEPS
View File

@ -28,6 +28,9 @@ deps = {
'crashpad/third_party/gyp/gyp':
Var('chromium_git') + '/external/gyp@' +
'8bee09f4a57807136593ddc906b0b213c21f9014',
'crashpad/third_party/lss/lss':
Var('chromium_git') + '/linux-syscall-support.git@' +
'8048ece6c16c91acfe0d36d1d3cc0890ab6e945c',
'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' +
'471390dc9c5a4244364c0f9c5d463ebc78083e2b',

View File

@ -82,13 +82,21 @@ static_library("client") {
"../util",
]
deps = []
if (crashpad_is_win) {
libs = [ "rpcrt4.lib" ]
cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union
}
if (crashpad_is_linux || crashpad_is_android) {
deps += [
"../third_party/lss",
]
}
if (crashpad_is_fuchsia) {
deps = [
deps += [
"../third_party/fuchsia",
]
if (crashpad_is_in_fuchsia) {

View File

@ -23,6 +23,7 @@
'dependencies': [
'../compat/compat.gyp:crashpad_compat',
'../third_party/mini_chromium/mini_chromium.gyp:base',
'../third_party/lss/lss.gyp:lss',
'../util/util.gyp:crashpad_util',
],
'include_dirs': [

View File

@ -25,6 +25,7 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "client/client_argv_handling.h"
#include "third_party/lss/lss.h"
#include "util/file/file_io.h"
#include "util/linux/exception_handler_client.h"
#include "util/linux/exception_information.h"
@ -149,7 +150,7 @@ class LaunchAtCrashHandler {
context);
exception_information_.thread_id = syscall(SYS_gettid);
ScopedPrSetPtracer set_ptracer(getpid(), /* may_log= */ false);
ScopedPrSetPtracer set_ptracer(sys_getpid(), /* may_log= */ false);
ScopedPrSetDumpable set_dumpable(/* may_log= */ false);
pid_t pid = fork();

31
third_party/lss/BUILD.gn vendored Normal file
View File

@ -0,0 +1,31 @@
# Copyright 2019 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.
import("../../build/crashpad_buildconfig.gni")
config("lss_config") {
if (crashpad_is_in_chromium) {
defines = [ "CRASHPAD_LSS_SOURCE_EXTERNAL" ]
} else {
defines = [ "CRASHPAD_LSS_SOURCE_EMBEDDED" ]
}
}
source_set("lss") {
public_configs = [ ":lss_config" ]
sources = [
"lss.h",
]
}

16
third_party/lss/README.crashpad vendored Normal file
View File

@ -0,0 +1,16 @@
Name: linux-syscall-support
Short Name: lss
URL: https://chromium.googlesource.com/linux-syscall-support/
Revision: See DEPS
License: BSD 3-clause
License File: lss/linux-syscall-support.h
Security Critical: yes
Description:
Every so often, projects need to directly embed Linux system calls instead of
calling the implementations in the system runtime library. This project
provides a header file that can be included into your application whenever you
need to make direct system calls.
Local Modifications:
None.

27
third_party/lss/lss.gyp vendored Normal file
View File

@ -0,0 +1,27 @@
# Copyright 2019 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.
{
'targets': [
{
'target_name': 'lss',
'type': 'none',
'sources': [ 'lss.h' ],
'direct_dependent_settings': {
# gyp is only used in circumstances when the embedded lss is used.
'defines': [ 'CRASHPAD_LSS_SOURCE_EMBEDDED' ]
},
}
]
}

26
third_party/lss/lss.h vendored Normal file
View File

@ -0,0 +1,26 @@
// Copyright 2019 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.
#ifndef CRASHPAD_THIRD_PARTY_LSS_LSS_H_
#define CRASHPAD_THIRD_PARTY_LSS_LSS_H_
#if defined(CRASHPAD_LSS_SOURCE_EXTERNAL)
#include "third_party/lss/linux_syscall_support.h"
#elif defined(CRASHPAD_LSS_SOURCE_EMBEDDED)
#include "third_party/lss/lss/linux_syscall_support.h"
#else
#error Unknown lss source
#endif
#endif // CRASHPAD_THIRD_PARTY_LSS_LSS_H_