2014-08-01 12:48:28 -04:00
|
|
|
|
# Copyright 2014 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.
|
|
|
|
|
|
|
|
|
|
{
|
2015-03-08 15:17:22 -04:00
|
|
|
|
'includes': [
|
|
|
|
|
'../build/crashpad.gypi',
|
|
|
|
|
],
|
2014-08-01 12:48:28 -04:00
|
|
|
|
'targets': [
|
|
|
|
|
{
|
2015-03-08 16:25:34 -04:00
|
|
|
|
'target_name': 'crashpad_util',
|
2014-08-01 12:48:28 -04:00
|
|
|
|
'type': 'static_library',
|
|
|
|
|
'dependencies': [
|
2015-03-08 16:25:34 -04:00
|
|
|
|
'../compat/compat.gyp:crashpad_compat',
|
2015-03-09 15:25:42 -04:00
|
|
|
|
'../third_party/mini_chromium/mini_chromium.gyp:base',
|
2017-02-15 19:54:19 -05:00
|
|
|
|
'../third_party/zlib/zlib.gyp:zlib',
|
2014-08-01 12:48:28 -04:00
|
|
|
|
],
|
|
|
|
|
'include_dirs': [
|
|
|
|
|
'..',
|
|
|
|
|
'<(INTERMEDIATE_DIR)',
|
|
|
|
|
],
|
|
|
|
|
'sources': [
|
2017-03-16 10:52:27 -04:00
|
|
|
|
'file/delimited_file_reader.cc',
|
|
|
|
|
'file/delimited_file_reader.h',
|
2014-12-17 14:35:18 -08:00
|
|
|
|
'file/file_io.cc',
|
|
|
|
|
'file/file_io.h',
|
|
|
|
|
'file/file_io_posix.cc',
|
|
|
|
|
'file/file_io_win.cc',
|
2015-02-18 14:15:38 -05:00
|
|
|
|
'file/file_reader.cc',
|
|
|
|
|
'file/file_reader.h',
|
2015-02-18 18:22:39 -05:00
|
|
|
|
'file/file_seeker.cc',
|
2015-02-18 14:15:38 -05:00
|
|
|
|
'file/file_seeker.h',
|
2014-08-01 12:48:28 -04:00
|
|
|
|
'file/file_writer.cc',
|
|
|
|
|
'file/file_writer.h',
|
2015-02-18 14:15:38 -05:00
|
|
|
|
'file/string_file.cc',
|
|
|
|
|
'file/string_file.h',
|
2017-04-03 14:09:58 -07:00
|
|
|
|
'linux/address_types.h',
|
2017-06-12 12:59:27 -07:00
|
|
|
|
'linux/auxiliary_vector.cc',
|
|
|
|
|
'linux/auxiliary_vector.h',
|
2017-04-19 13:45:41 -07:00
|
|
|
|
'linux/checked_address_range.h',
|
2017-09-22 09:14:52 -07:00
|
|
|
|
'linux/direct_ptrace_connection.cc',
|
|
|
|
|
'linux/direct_ptrace_connection.h',
|
2017-04-25 08:12:49 -07:00
|
|
|
|
'linux/memory_map.cc',
|
|
|
|
|
'linux/memory_map.h',
|
2017-07-24 14:45:39 -04:00
|
|
|
|
'linux/proc_stat_reader.cc',
|
|
|
|
|
'linux/proc_stat_reader.h',
|
2017-04-03 14:09:58 -07:00
|
|
|
|
'linux/process_memory.cc',
|
|
|
|
|
'linux/process_memory.h',
|
2017-06-29 15:18:45 -07:00
|
|
|
|
'linux/process_memory_range.cc',
|
|
|
|
|
'linux/process_memory_range.h',
|
2017-09-22 09:14:52 -07:00
|
|
|
|
'linux/ptrace_connection.h',
|
|
|
|
|
'linux/ptracer.cc',
|
|
|
|
|
'linux/ptracer.h',
|
2017-04-07 11:48:04 -07:00
|
|
|
|
'linux/scoped_ptrace_attach.cc',
|
|
|
|
|
'linux/scoped_ptrace_attach.h',
|
2017-07-24 14:45:39 -04:00
|
|
|
|
'linux/thread_info.cc',
|
|
|
|
|
'linux/thread_info.h',
|
2017-08-01 19:05:06 -07:00
|
|
|
|
'linux/traits.h',
|
2014-08-28 13:47:28 -04:00
|
|
|
|
'mac/checked_mach_address_range.h',
|
2014-09-22 13:11:40 -04:00
|
|
|
|
'mac/launchd.h',
|
|
|
|
|
'mac/launchd.mm',
|
2014-08-15 22:33:14 -07:00
|
|
|
|
'mac/mac_util.cc',
|
|
|
|
|
'mac/mac_util.h',
|
2014-08-15 22:30:24 -07:00
|
|
|
|
'mac/service_management.cc',
|
|
|
|
|
'mac/service_management.h',
|
2014-12-30 17:39:27 -05:00
|
|
|
|
'mac/xattr.cc',
|
|
|
|
|
'mac/xattr.h',
|
2014-12-11 11:27:18 -05:00
|
|
|
|
'mach/child_port.defs',
|
2014-11-25 14:56:05 -05:00
|
|
|
|
'mach/child_port_handshake.cc',
|
|
|
|
|
'mach/child_port_handshake.h',
|
2014-11-25 14:29:46 -05:00
|
|
|
|
'mach/child_port_server.cc',
|
|
|
|
|
'mach/child_port_server.h',
|
2014-11-24 15:48:10 -05:00
|
|
|
|
'mach/child_port_types.h',
|
2014-12-04 16:45:02 -05:00
|
|
|
|
'mach/composite_mach_message_server.cc',
|
|
|
|
|
'mach/composite_mach_message_server.h',
|
2014-09-16 09:48:01 -04:00
|
|
|
|
'mach/exc_client_variants.cc',
|
|
|
|
|
'mach/exc_client_variants.h',
|
2014-09-10 17:29:07 -04:00
|
|
|
|
'mach/exc_server_variants.cc',
|
|
|
|
|
'mach/exc_server_variants.h',
|
2014-09-16 17:32:35 -04:00
|
|
|
|
'mach/exception_behaviors.cc',
|
|
|
|
|
'mach/exception_behaviors.h',
|
2014-09-16 17:36:33 -04:00
|
|
|
|
'mach/exception_ports.cc',
|
|
|
|
|
'mach/exception_ports.h',
|
2015-04-08 17:46:09 -04:00
|
|
|
|
'mach/exception_types.cc',
|
|
|
|
|
'mach/exception_types.h',
|
2014-09-16 09:48:01 -04:00
|
|
|
|
'mach/mach_extensions.cc',
|
2014-09-10 17:29:07 -04:00
|
|
|
|
'mach/mach_extensions.h',
|
2014-12-02 17:02:32 -05:00
|
|
|
|
'mach/mach_message.cc',
|
|
|
|
|
'mach/mach_message.h',
|
2014-09-08 21:06:34 -04:00
|
|
|
|
'mach/mach_message_server.cc',
|
|
|
|
|
'mach/mach_message_server.h',
|
2014-12-16 14:10:16 -05:00
|
|
|
|
'mach/notify_server.cc',
|
|
|
|
|
'mach/notify_server.h',
|
2014-10-13 18:05:21 -04:00
|
|
|
|
'mach/scoped_task_suspend.cc',
|
|
|
|
|
'mach/scoped_task_suspend.h',
|
2014-09-16 11:00:51 -04:00
|
|
|
|
'mach/symbolic_constants_mach.cc',
|
|
|
|
|
'mach/symbolic_constants_mach.h',
|
2014-11-14 17:56:17 -05:00
|
|
|
|
'mach/task_for_pid.cc',
|
|
|
|
|
'mach/task_for_pid.h',
|
2014-08-03 18:48:40 -04:00
|
|
|
|
'mach/task_memory.cc',
|
|
|
|
|
'mach/task_memory.h',
|
2016-11-22 14:27:51 -05:00
|
|
|
|
'misc/address_sanitizer.h',
|
2017-09-12 16:39:53 -07:00
|
|
|
|
'misc/address_types.h',
|
2016-11-10 14:39:51 -05:00
|
|
|
|
'misc/arraysize_unsafe.h',
|
2014-09-24 14:08:48 -04:00
|
|
|
|
'misc/clock.h',
|
|
|
|
|
'misc/clock_mac.cc',
|
2014-12-17 10:45:43 -08:00
|
|
|
|
'misc/clock_posix.cc',
|
|
|
|
|
'misc/clock_win.cc',
|
2017-04-27 15:08:17 -04:00
|
|
|
|
'misc/from_pointer_cast.h',
|
2015-09-14 11:09:46 -07:00
|
|
|
|
'misc/implicit_cast.h',
|
2014-08-14 09:51:26 -07:00
|
|
|
|
'misc/initialization_state.h',
|
|
|
|
|
'misc/initialization_state_dcheck.cc',
|
|
|
|
|
'misc/initialization_state_dcheck.h',
|
2017-07-24 10:55:02 -07:00
|
|
|
|
'misc/lexing.cc',
|
|
|
|
|
'misc/lexing.h',
|
2016-09-02 12:10:57 -07:00
|
|
|
|
'misc/metrics.cc',
|
|
|
|
|
'misc/metrics.h',
|
2017-04-03 13:53:11 -04:00
|
|
|
|
'misc/paths.h',
|
|
|
|
|
'misc/paths_mac.cc',
|
|
|
|
|
'misc/paths_linux.cc',
|
|
|
|
|
'misc/paths_win.cc',
|
2015-09-01 09:32:09 -07:00
|
|
|
|
'misc/pdb_structures.cc',
|
|
|
|
|
'misc/pdb_structures.h',
|
2015-11-16 13:39:01 -05:00
|
|
|
|
'misc/random_string.cc',
|
|
|
|
|
'misc/random_string.h',
|
2017-06-19 15:56:07 -07:00
|
|
|
|
'misc/reinterpret_bytes.cc',
|
|
|
|
|
'misc/reinterpret_bytes.h',
|
2014-08-26 16:50:08 -04:00
|
|
|
|
'misc/scoped_forbid_return.cc',
|
|
|
|
|
'misc/scoped_forbid_return.h',
|
2014-09-10 17:30:21 -04:00
|
|
|
|
'misc/symbolic_constants_common.h',
|
2015-03-11 17:07:11 -04:00
|
|
|
|
'misc/tri_state.h',
|
2014-08-01 14:39:55 -04:00
|
|
|
|
'misc/uuid.cc',
|
|
|
|
|
'misc/uuid.h',
|
2017-02-15 19:54:19 -05:00
|
|
|
|
'misc/zlib.cc',
|
|
|
|
|
'misc/zlib.h',
|
2014-10-24 15:04:25 -04:00
|
|
|
|
'net/http_body.cc',
|
|
|
|
|
'net/http_body.h',
|
2017-02-15 19:54:19 -05:00
|
|
|
|
'net/http_body_gzip.cc',
|
|
|
|
|
'net/http_body_gzip.h',
|
2014-10-31 12:17:32 -04:00
|
|
|
|
'net/http_headers.h',
|
2014-10-29 19:13:24 -04:00
|
|
|
|
'net/http_multipart_builder.cc',
|
|
|
|
|
'net/http_multipart_builder.h',
|
2014-10-31 12:17:32 -04:00
|
|
|
|
'net/http_transport.cc',
|
|
|
|
|
'net/http_transport.h',
|
2017-03-03 14:47:03 -05:00
|
|
|
|
'net/http_transport_libcurl.cc',
|
2014-10-31 12:17:32 -04:00
|
|
|
|
'net/http_transport_mac.mm',
|
2015-01-26 13:31:35 -08:00
|
|
|
|
'net/http_transport_win.cc',
|
2015-05-01 13:48:23 -07:00
|
|
|
|
'numeric/checked_address_range.cc',
|
|
|
|
|
'numeric/checked_address_range.h',
|
2014-08-15 10:22:37 -07:00
|
|
|
|
'numeric/checked_range.h',
|
2017-09-12 16:39:53 -07:00
|
|
|
|
'numeric/checked_vm_address_range.h',
|
2014-08-14 16:00:44 -07:00
|
|
|
|
'numeric/in_range_cast.h',
|
2014-09-22 15:46:00 -04:00
|
|
|
|
'numeric/int128.h',
|
2014-08-14 16:00:44 -07:00
|
|
|
|
'numeric/safe_assignment.h',
|
2014-12-19 16:42:34 -05:00
|
|
|
|
'posix/close_multiple.cc',
|
|
|
|
|
'posix/close_multiple.h',
|
2014-12-19 14:20:20 -05:00
|
|
|
|
'posix/close_stdio.cc',
|
|
|
|
|
'posix/close_stdio.h',
|
2014-11-14 18:44:19 -05:00
|
|
|
|
'posix/drop_privileges.cc',
|
|
|
|
|
'posix/drop_privileges.h',
|
Move some parts of ProcessReader (in snapshot) to ProcessInfo (in util).
Also, move ProcessArgumentsForPID() into ProcessInfo.
This change prepares for a TaskForPID() implementation that’s capable of
operating correctly in a setuid root executable. TaskForPID() belongs in
util/mach, but for its permission checks, it must access some process
properties that were previously fetched by ProcessReader in snapshot.
util can’t depend on snapshot. The generic util-safe process information
bits (Is64Bit(), ProcessID(), ParentProcessID(), and StartTime()) are
moved from ProcessReader to ProcessInfo (in util), where the current
ProcessReader can use it (as it’s OK for snapshot to depend on util),
and the future TaskForPID() in util can also use it. ProcessInfo also
contains other methods that TaskForPID() will use, providing access to
the credentials that the target process holds. ProcessArgumentsForPID()
is related, and is also now a part of ProcessInfo.
TEST=snapshot_test, util_test
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/727973002
2014-11-14 17:54:42 -05:00
|
|
|
|
'posix/process_info.h',
|
2017-03-14 13:05:40 -07:00
|
|
|
|
'posix/process_info_linux.cc',
|
Move some parts of ProcessReader (in snapshot) to ProcessInfo (in util).
Also, move ProcessArgumentsForPID() into ProcessInfo.
This change prepares for a TaskForPID() implementation that’s capable of
operating correctly in a setuid root executable. TaskForPID() belongs in
util/mach, but for its permission checks, it must access some process
properties that were previously fetched by ProcessReader in snapshot.
util can’t depend on snapshot. The generic util-safe process information
bits (Is64Bit(), ProcessID(), ParentProcessID(), and StartTime()) are
moved from ProcessReader to ProcessInfo (in util), where the current
ProcessReader can use it (as it’s OK for snapshot to depend on util),
and the future TaskForPID() in util can also use it. ProcessInfo also
contains other methods that TaskForPID() will use, providing access to
the credentials that the target process holds. ProcessArgumentsForPID()
is related, and is also now a part of ProcessInfo.
TEST=snapshot_test, util_test
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/727973002
2014-11-14 17:54:42 -05:00
|
|
|
|
'posix/process_info_mac.cc',
|
2017-04-05 09:42:54 -07:00
|
|
|
|
'posix/scoped_dir.cc',
|
|
|
|
|
'posix/scoped_dir.h',
|
2017-03-28 12:21:43 -04:00
|
|
|
|
'posix/scoped_mmap.cc',
|
|
|
|
|
'posix/scoped_mmap.h',
|
2017-03-01 10:00:59 -05:00
|
|
|
|
'posix/signals.cc',
|
|
|
|
|
'posix/signals.h',
|
2014-09-10 17:30:21 -04:00
|
|
|
|
'posix/symbolic_constants_posix.cc',
|
|
|
|
|
'posix/symbolic_constants_posix.h',
|
2015-12-08 15:38:17 -05:00
|
|
|
|
'stdlib/aligned_allocator.cc',
|
|
|
|
|
'stdlib/aligned_allocator.h',
|
2014-08-01 14:39:55 -04:00
|
|
|
|
'stdlib/cxx.h',
|
2015-03-31 14:29:32 -04:00
|
|
|
|
'stdlib/map_insert.h',
|
2014-08-03 18:53:10 -04:00
|
|
|
|
'stdlib/objc.h',
|
2014-08-25 17:51:09 -04:00
|
|
|
|
'stdlib/pointer_container.h',
|
2014-09-10 15:30:11 -04:00
|
|
|
|
'stdlib/string_number_conversion.cc',
|
|
|
|
|
'stdlib/string_number_conversion.h',
|
2014-08-01 14:39:55 -04:00
|
|
|
|
'stdlib/strlcpy.cc',
|
|
|
|
|
'stdlib/strlcpy.h',
|
2014-08-28 14:38:27 -04:00
|
|
|
|
'stdlib/strnlen.cc',
|
|
|
|
|
'stdlib/strnlen.h',
|
2017-04-14 14:50:11 -04:00
|
|
|
|
'stdlib/thread_safe_vector.h',
|
2015-03-12 14:28:19 -04:00
|
|
|
|
'string/split_string.cc',
|
|
|
|
|
'string/split_string.h',
|
2015-02-10 17:01:58 -05:00
|
|
|
|
'synchronization/semaphore_mac.cc',
|
|
|
|
|
'synchronization/semaphore_posix.cc',
|
|
|
|
|
'synchronization/semaphore_win.cc',
|
2014-09-24 13:32:31 -04:00
|
|
|
|
'synchronization/semaphore.h',
|
2015-05-13 14:05:57 -04:00
|
|
|
|
'thread/thread.cc',
|
|
|
|
|
'thread/thread.h',
|
2015-03-30 14:51:34 -04:00
|
|
|
|
'thread/thread_log_messages.cc',
|
|
|
|
|
'thread/thread_log_messages.h',
|
2015-05-13 14:05:57 -04:00
|
|
|
|
'thread/thread_posix.cc',
|
|
|
|
|
'thread/thread_win.cc',
|
2016-01-04 17:10:58 -05:00
|
|
|
|
'thread/worker_thread.cc',
|
|
|
|
|
'thread/worker_thread.h',
|
2015-05-01 13:48:23 -07:00
|
|
|
|
'win/address_types.h',
|
2015-09-30 14:10:08 -04:00
|
|
|
|
'win/capture_context.asm',
|
|
|
|
|
'win/capture_context.h',
|
2015-05-01 13:48:23 -07:00
|
|
|
|
'win/checked_win_address_range.h',
|
2015-11-02 13:59:36 -05:00
|
|
|
|
'win/command_line.cc',
|
|
|
|
|
'win/command_line.h',
|
2015-10-16 14:55:14 -07:00
|
|
|
|
'win/critical_section_with_debug_info.cc',
|
|
|
|
|
'win/critical_section_with_debug_info.h',
|
win: Crash handler server
This replaces the registration server, and adds dispatch to a delegate
on crash requests.
(As you are already aware) we went around in circles on trying to come
up with a slightly-too-fancy threading design. All of them seemed to
have problems when it comes to out of order events, and orderly
shutdown, so I've gone back to something not-too-fancy.
Two named pipe instances (that clients connect to) are created. These
are used only for registration (which should take <1ms), so 2 should be
sufficient to avoid any waits. When a client registers, we duplicate
an event to it, which is used to signal when it wants a dump taken.
The server registers threadpool waits on that event, and also on the
process handle (which will be signalled when the client process exits).
These requests (in particular the taking of the dump) are serviced
on the threadpool, which avoids us needing to manage those threads,
but still allows parallelism in taking dumps. On process termination,
we use an IO Completion Port to post a message back to the main thread
to request cleanup. This complexity is necessary so that we can
unregister the threadpool waits without being on the threadpool, which
we need to do synchronously so that we can be sure that no further
callbacks will execute (and expect to have the client data around
still).
In a followup, I will readd support for DumpWithoutCrashing -- I don't
think it will be too difficult now that we have an orderly way to
clean up client records in the server.
R=cpu@chromium.org, mark@chromium.org, jschuh@chromium.org
BUG=crashpad:1,crashpad:45
Review URL: https://codereview.chromium.org/1301853002 .
2015-09-03 11:06:17 -07:00
|
|
|
|
'win/exception_handler_server.cc',
|
|
|
|
|
'win/exception_handler_server.h',
|
2015-10-19 14:32:07 -04:00
|
|
|
|
'win/get_function.cc',
|
|
|
|
|
'win/get_function.h',
|
2016-01-18 15:05:20 -05:00
|
|
|
|
'win/get_module_information.cc',
|
|
|
|
|
'win/get_module_information.h',
|
2015-11-05 14:00:26 -05:00
|
|
|
|
'win/handle.cc',
|
|
|
|
|
'win/handle.h',
|
2016-10-21 13:08:18 -07:00
|
|
|
|
'win/initial_client_data.cc',
|
|
|
|
|
'win/initial_client_data.h',
|
2015-05-14 17:43:49 -07:00
|
|
|
|
'win/module_version.cc',
|
|
|
|
|
'win/module_version.h',
|
2015-08-18 12:25:19 -07:00
|
|
|
|
'win/nt_internals.cc',
|
|
|
|
|
'win/nt_internals.h',
|
2015-09-15 09:22:29 -07:00
|
|
|
|
'win/ntstatus_logging.cc',
|
|
|
|
|
'win/ntstatus_logging.h',
|
2015-03-05 22:07:38 -08:00
|
|
|
|
'win/process_info.cc',
|
|
|
|
|
'win/process_info.h',
|
2015-03-09 16:37:43 -07:00
|
|
|
|
'win/process_structs.h',
|
win: Crash handler server
This replaces the registration server, and adds dispatch to a delegate
on crash requests.
(As you are already aware) we went around in circles on trying to come
up with a slightly-too-fancy threading design. All of them seemed to
have problems when it comes to out of order events, and orderly
shutdown, so I've gone back to something not-too-fancy.
Two named pipe instances (that clients connect to) are created. These
are used only for registration (which should take <1ms), so 2 should be
sufficient to avoid any waits. When a client registers, we duplicate
an event to it, which is used to signal when it wants a dump taken.
The server registers threadpool waits on that event, and also on the
process handle (which will be signalled when the client process exits).
These requests (in particular the taking of the dump) are serviced
on the threadpool, which avoids us needing to manage those threads,
but still allows parallelism in taking dumps. On process termination,
we use an IO Completion Port to post a message back to the main thread
to request cleanup. This complexity is necessary so that we can
unregister the threadpool waits without being on the threadpool, which
we need to do synchronously so that we can be sure that no further
callbacks will execute (and expect to have the client data around
still).
In a followup, I will readd support for DumpWithoutCrashing -- I don't
think it will be too difficult now that we have an orderly way to
clean up client records in the server.
R=cpu@chromium.org, mark@chromium.org, jschuh@chromium.org
BUG=crashpad:1,crashpad:45
Review URL: https://codereview.chromium.org/1301853002 .
2015-09-03 11:06:17 -07:00
|
|
|
|
'win/registration_protocol_win.cc',
|
|
|
|
|
'win/registration_protocol_win.h',
|
win: Wrap TerminateProcess() to accept cdecl patches on x86
TerminateProcess(), like most of the Windows API, is declared WINAPI,
which is __stdcall on 32-bit x86. That means that the callee,
TerminateProcess() itself, is responsible for cleaning up parameters on
the stack on return. In https://crashpad.chromium.org/bug/179, crashes
in ExceptionHandlerServer::OnNonCrashDumpEvent() were observed in ways
that make it evident that TerminateProcess() has been patched with a
__cdecl routine. The crucial difference between __stdcall and __cdecl is
that the caller is responsible for stack parameter cleanup in __cdecl.
The mismatch means that nobody cleans parameters from the stack, and the
stack pointer has an unexpected value, which in the case of the Crashpad
handler crash, results in TerminateProcess()’s second argument
erroneously being used as the lock address in the call to
ReleaseSRWLockExclusive() or LeaveCriticalSection().
As a workaround, on 32-bit x86, call through SafeTerminateProcess(), a
custom assembly routine that’s compatible with either __stdcall or
__cdecl implementations of TerminateProcess() by not trusting the value
of the stack pointer on return from that function. Instead, the stack
pointer is restored directly from the frame pointer.
Bug: crashpad:179
Test: crashpad_util_test SafeTerminateProcess.*, others
Change-Id: If9508f4eb7631020ea69ddbbe4a22eb335cdb325
Reviewed-on: https://chromium-review.googlesource.com/481180
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-19 13:22:08 -04:00
|
|
|
|
'win/safe_terminate_process.asm',
|
|
|
|
|
'win/safe_terminate_process.h',
|
2014-12-18 09:51:20 -08:00
|
|
|
|
'win/scoped_handle.cc',
|
|
|
|
|
'win/scoped_handle.h',
|
2015-11-06 10:43:39 -08:00
|
|
|
|
'win/scoped_local_alloc.cc',
|
|
|
|
|
'win/scoped_local_alloc.h',
|
2015-09-08 10:09:26 -07:00
|
|
|
|
'win/scoped_process_suspend.cc',
|
|
|
|
|
'win/scoped_process_suspend.h',
|
2017-02-22 13:39:46 -05:00
|
|
|
|
'win/session_end_watcher.cc',
|
|
|
|
|
'win/session_end_watcher.h',
|
2016-09-28 20:18:39 -07:00
|
|
|
|
'win/termination_codes.h',
|
2015-02-20 11:35:04 -08:00
|
|
|
|
'win/time.cc',
|
|
|
|
|
'win/time.h',
|
2015-09-11 13:16:06 -07:00
|
|
|
|
'win/xp_compat.h',
|
2014-08-01 12:48:28 -04:00
|
|
|
|
],
|
2014-09-30 13:11:04 -07:00
|
|
|
|
'conditions': [
|
|
|
|
|
['OS=="mac"', {
|
2014-12-11 11:27:18 -05:00
|
|
|
|
'conditions': [
|
|
|
|
|
['GENERATOR=="ninja"', {
|
|
|
|
|
# ninja’s rules can’t deal with sources that have paths relative
|
|
|
|
|
# to environment variables like SDKROOT. Copy the .defs files out
|
|
|
|
|
# of SDKROOT and into a place they can be referenced without any
|
|
|
|
|
# environment variables.
|
|
|
|
|
'copies': [
|
|
|
|
|
{
|
|
|
|
|
'destination': '<(INTERMEDIATE_DIR)/util/mach',
|
|
|
|
|
'files': [
|
|
|
|
|
'$(SDKROOT)/usr/include/mach/exc.defs',
|
|
|
|
|
'$(SDKROOT)/usr/include/mach/mach_exc.defs',
|
2014-12-16 14:10:16 -05:00
|
|
|
|
'$(SDKROOT)/usr/include/mach/notify.defs',
|
2014-12-11 11:27:18 -05:00
|
|
|
|
],
|
|
|
|
|
},
|
2014-11-24 15:48:10 -05:00
|
|
|
|
],
|
2014-12-11 11:27:18 -05:00
|
|
|
|
'sources': [
|
|
|
|
|
'<(INTERMEDIATE_DIR)/util/mach/exc.defs',
|
|
|
|
|
'<(INTERMEDIATE_DIR)/util/mach/mach_exc.defs',
|
2014-12-16 14:10:16 -05:00
|
|
|
|
'<(INTERMEDIATE_DIR)/util/mach/notify.defs',
|
2014-11-24 15:48:10 -05:00
|
|
|
|
],
|
2014-12-11 11:27:18 -05:00
|
|
|
|
}, { # else: GENERATOR!="ninja"
|
|
|
|
|
# The Xcode generator does copies after rules, so the above trick
|
|
|
|
|
# won’t work, but its rules tolerate sources with SDKROOT-relative
|
|
|
|
|
# paths.
|
|
|
|
|
'sources': [
|
2014-09-30 13:11:04 -07:00
|
|
|
|
'$(SDKROOT)/usr/include/mach/exc.defs',
|
2014-12-11 11:27:18 -05:00
|
|
|
|
'$(SDKROOT)/usr/include/mach/mach_exc.defs',
|
2014-12-16 14:10:16 -05:00
|
|
|
|
'$(SDKROOT)/usr/include/mach/notify.defs',
|
2014-09-30 13:11:04 -07:00
|
|
|
|
],
|
2014-12-11 11:27:18 -05:00
|
|
|
|
}],
|
|
|
|
|
],
|
|
|
|
|
'rules': [
|
2014-09-30 13:11:04 -07:00
|
|
|
|
{
|
2014-12-11 11:27:18 -05:00
|
|
|
|
'rule_name': 'mig',
|
|
|
|
|
'extension': 'defs',
|
2014-09-30 13:11:04 -07:00
|
|
|
|
'inputs': [
|
|
|
|
|
'mach/mig.py',
|
|
|
|
|
],
|
|
|
|
|
'outputs': [
|
2014-12-11 11:27:18 -05:00
|
|
|
|
'<(INTERMEDIATE_DIR)/util/mach/<(RULE_INPUT_ROOT)User.c',
|
|
|
|
|
'<(INTERMEDIATE_DIR)/util/mach/<(RULE_INPUT_ROOT)Server.c',
|
|
|
|
|
'<(INTERMEDIATE_DIR)/util/mach/<(RULE_INPUT_ROOT).h',
|
|
|
|
|
'<(INTERMEDIATE_DIR)/util/mach/<(RULE_INPUT_ROOT)Server.h',
|
2014-09-30 13:11:04 -07:00
|
|
|
|
],
|
|
|
|
|
'action': [
|
2017-06-20 09:50:37 -04:00
|
|
|
|
'python',
|
|
|
|
|
'<@(_inputs)',
|
|
|
|
|
'<(RULE_INPUT_PATH)',
|
|
|
|
|
'<@(_outputs)',
|
|
|
|
|
'--include=../compat/mac'
|
2014-09-30 13:11:04 -07:00
|
|
|
|
],
|
|
|
|
|
'process_outputs_as_sources': 1,
|
|
|
|
|
},
|
2014-09-05 13:27:06 -04:00
|
|
|
|
],
|
2014-09-30 13:11:04 -07:00
|
|
|
|
'link_settings': {
|
|
|
|
|
'libraries': [
|
|
|
|
|
'$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
|
|
|
|
|
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
|
|
|
|
|
'$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
|
2015-03-12 14:00:38 -04:00
|
|
|
|
'$(SDKROOT)/usr/lib/libbsm.dylib',
|
2014-09-30 13:11:04 -07:00
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
}],
|
2015-01-26 13:31:35 -08:00
|
|
|
|
['OS=="win"', {
|
|
|
|
|
'link_settings': {
|
|
|
|
|
'libraries': [
|
2017-02-22 13:39:46 -05:00
|
|
|
|
'-luser32.lib',
|
2017-03-01 12:56:41 -05:00
|
|
|
|
'-lversion.lib',
|
2015-01-26 13:31:35 -08:00
|
|
|
|
'-lwinhttp.lib',
|
|
|
|
|
],
|
|
|
|
|
},
|
2015-10-23 14:07:59 -07:00
|
|
|
|
'msvs_disabled_warnings': [
|
|
|
|
|
4201, # nonstandard extension used : nameless struct/union.
|
2015-12-14 20:01:05 -05:00
|
|
|
|
4577, # 'noexcept' used with no exception handling mode specified
|
2015-10-23 14:07:59 -07:00
|
|
|
|
],
|
2016-04-20 15:30:20 -07:00
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
|
'msvs_disabled_warnings': [
|
|
|
|
|
4577, # 'noexcept' used with no exception handling mode specified
|
|
|
|
|
],
|
|
|
|
|
},
|
2015-09-30 14:10:08 -04:00
|
|
|
|
'conditions': [
|
|
|
|
|
['target_arch=="ia32"', {
|
|
|
|
|
'msvs_settings': {
|
|
|
|
|
'MASM': {
|
|
|
|
|
'UseSafeExceptionHandlers': 'true',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
],
|
2016-11-01 16:47:10 -04:00
|
|
|
|
}, { # else: OS!="win"
|
|
|
|
|
'sources!': [
|
|
|
|
|
'win/capture_context.asm',
|
win: Wrap TerminateProcess() to accept cdecl patches on x86
TerminateProcess(), like most of the Windows API, is declared WINAPI,
which is __stdcall on 32-bit x86. That means that the callee,
TerminateProcess() itself, is responsible for cleaning up parameters on
the stack on return. In https://crashpad.chromium.org/bug/179, crashes
in ExceptionHandlerServer::OnNonCrashDumpEvent() were observed in ways
that make it evident that TerminateProcess() has been patched with a
__cdecl routine. The crucial difference between __stdcall and __cdecl is
that the caller is responsible for stack parameter cleanup in __cdecl.
The mismatch means that nobody cleans parameters from the stack, and the
stack pointer has an unexpected value, which in the case of the Crashpad
handler crash, results in TerminateProcess()’s second argument
erroneously being used as the lock address in the call to
ReleaseSRWLockExclusive() or LeaveCriticalSection().
As a workaround, on 32-bit x86, call through SafeTerminateProcess(), a
custom assembly routine that’s compatible with either __stdcall or
__cdecl implementations of TerminateProcess() by not trusting the value
of the stack pointer on return from that function. Instead, the stack
pointer is restored directly from the frame pointer.
Bug: crashpad:179
Test: crashpad_util_test SafeTerminateProcess.*, others
Change-Id: If9508f4eb7631020ea69ddbbe4a22eb335cdb325
Reviewed-on: https://chromium-review.googlesource.com/481180
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-19 13:22:08 -04:00
|
|
|
|
'win/safe_terminate_process.asm',
|
2016-11-01 16:47:10 -04:00
|
|
|
|
],
|
2015-01-26 13:31:35 -08:00
|
|
|
|
}],
|
2017-03-03 14:47:03 -05:00
|
|
|
|
['OS=="linux"', {
|
|
|
|
|
'link_settings': {
|
|
|
|
|
'libraries': [
|
|
|
|
|
'-lcurl',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
}, { # else: OS!="linux"
|
|
|
|
|
'sources!': [
|
|
|
|
|
'net/http_transport_libcurl.cc',
|
|
|
|
|
],
|
|
|
|
|
}],
|
2014-09-05 13:27:06 -04:00
|
|
|
|
],
|
2017-03-14 13:05:40 -07:00
|
|
|
|
'target_conditions': [
|
|
|
|
|
['OS=="android"', {
|
|
|
|
|
'sources/': [
|
2017-04-03 14:09:58 -07:00
|
|
|
|
['include', '^linux/'],
|
2017-04-03 13:53:11 -04:00
|
|
|
|
['include', '^misc/paths_linux\\.cc$'],
|
2017-03-14 13:05:40 -07:00
|
|
|
|
['include', '^posix/process_info_linux\\.cc$'],
|
|
|
|
|
],
|
|
|
|
|
}],
|
|
|
|
|
],
|
2014-08-01 12:48:28 -04:00
|
|
|
|
},
|
2015-03-05 22:07:38 -08:00
|
|
|
|
],
|
2014-08-01 12:48:28 -04:00
|
|
|
|
}
|