2022-09-06 19:14:07 -04:00
|
|
|
|
// Copyright 2014 The Crashpad Authors
|
2014-08-25 17:51:09 -04:00
|
|
|
|
//
|
|
|
|
|
// 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.
|
|
|
|
|
|
2018-02-22 12:12:26 -08:00
|
|
|
|
#ifndef CRASHPAD_SNAPSHOT_MAC_PROCESS_READER_MAC_H_
|
|
|
|
|
#define CRASHPAD_SNAPSHOT_MAC_PROCESS_READER_MAC_H_
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
2020-09-01 20:21:15 -04:00
|
|
|
|
#include <Availability.h>
|
2014-08-25 17:51:09 -04:00
|
|
|
|
#include <mach/mach.h>
|
2016-01-06 12:22:50 -05:00
|
|
|
|
#include <stdint.h>
|
2014-08-25 17:51:09 -04:00
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
2016-04-25 12:13:07 -07:00
|
|
|
|
#include <memory>
|
2014-08-25 17:51:09 -04:00
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
|
#include "util/misc/initialization_state_dcheck.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
|
|
|
|
#include "util/posix/process_info.h"
|
2018-12-20 13:12:55 -08:00
|
|
|
|
#include "util/process/process_memory_mac.h"
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
2020-09-01 20:21:15 -04:00
|
|
|
|
#if defined(ARCH_CPU_32_BIT) || \
|
|
|
|
|
(!defined(ARCH_CPU_ARM64) && \
|
|
|
|
|
__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_15)
|
|
|
|
|
// There’s no 32-bit x86 environment on macOS 10.15 or later, and there’s no
|
|
|
|
|
// 32-bit ARM environment for macOS at all.
|
|
|
|
|
#define CRASHPAD_MAC_32_BIT_SUPPORT 1
|
|
|
|
|
#endif // ARCH_CPU_32_BIT || (!ARCH_CPU_ARM64 && DT < 10.15)
|
|
|
|
|
|
2014-08-25 17:51:09 -04:00
|
|
|
|
namespace crashpad {
|
|
|
|
|
|
2014-09-22 13:08:57 -04:00
|
|
|
|
class MachOImageReader;
|
|
|
|
|
|
2014-09-05 16:35:16 -04:00
|
|
|
|
//! \brief Accesses information about another process, identified by a Mach
|
|
|
|
|
//! task.
|
2018-02-22 12:12:26 -08:00
|
|
|
|
class ProcessReaderMac {
|
2014-09-05 16:35:16 -04:00
|
|
|
|
public:
|
|
|
|
|
//! \brief Contains information about a thread that belongs to a task
|
|
|
|
|
//! (process).
|
|
|
|
|
struct Thread {
|
2014-08-25 17:51:09 -04:00
|
|
|
|
#if defined(ARCH_CPU_X86_FAMILY)
|
2014-09-05 16:35:16 -04:00
|
|
|
|
union ThreadContext {
|
|
|
|
|
x86_thread_state64_t t64;
|
|
|
|
|
x86_thread_state32_t t32;
|
|
|
|
|
};
|
|
|
|
|
union FloatContext {
|
|
|
|
|
x86_float_state64_t f64;
|
|
|
|
|
x86_float_state32_t f32;
|
|
|
|
|
};
|
|
|
|
|
union DebugContext {
|
|
|
|
|
x86_debug_state64_t d64;
|
|
|
|
|
x86_debug_state32_t d32;
|
|
|
|
|
};
|
2020-07-07 23:43:11 -04:00
|
|
|
|
#elif defined(ARCH_CPU_ARM64)
|
|
|
|
|
using ThreadContext = arm_thread_state64_t;
|
|
|
|
|
using FloatContext = arm_neon_state64_t;
|
|
|
|
|
using DebugContext = arm_debug_state64_t;
|
2014-08-25 17:51:09 -04:00
|
|
|
|
#endif
|
|
|
|
|
|
2014-09-05 16:35:16 -04:00
|
|
|
|
Thread();
|
|
|
|
|
~Thread() {}
|
|
|
|
|
|
|
|
|
|
ThreadContext thread_context;
|
|
|
|
|
FloatContext float_context;
|
|
|
|
|
DebugContext debug_context;
|
2022-06-13 14:44:24 -06:00
|
|
|
|
std::string name;
|
2014-09-05 16:35:16 -04:00
|
|
|
|
uint64_t id;
|
|
|
|
|
mach_vm_address_t stack_region_address;
|
|
|
|
|
mach_vm_size_t stack_region_size;
|
|
|
|
|
mach_vm_address_t thread_specific_data_address;
|
2014-10-03 12:05:56 -04:00
|
|
|
|
thread_t port;
|
2014-09-05 16:35:16 -04:00
|
|
|
|
int suspend_count;
|
|
|
|
|
int priority;
|
|
|
|
|
};
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
2014-09-05 16:35:16 -04:00
|
|
|
|
//! \brief Contains information about a module loaded into a process.
|
|
|
|
|
struct Module {
|
|
|
|
|
Module();
|
|
|
|
|
~Module();
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
2014-09-05 16:35:16 -04:00
|
|
|
|
//! \brief The pathname used to load the module from disk.
|
|
|
|
|
std::string name;
|
2014-09-05 13:43:51 -04:00
|
|
|
|
|
2014-09-22 13:08:57 -04:00
|
|
|
|
//! \brief An image reader for the module.
|
|
|
|
|
//!
|
|
|
|
|
//! The lifetime of this MachOImageReader is scoped to the lifetime of the
|
2018-02-22 12:12:26 -08:00
|
|
|
|
//! ProcessReaderMac that created it.
|
2015-03-08 21:02:42 -04:00
|
|
|
|
//!
|
|
|
|
|
//! This field may be `nullptr` if a reader could not be created for the
|
|
|
|
|
//! module.
|
2014-09-22 13:08:57 -04:00
|
|
|
|
const MachOImageReader* reader;
|
2014-09-05 13:43:51 -04:00
|
|
|
|
|
2014-09-05 16:35:16 -04:00
|
|
|
|
//! \brief The module’s timestamp.
|
|
|
|
|
//!
|
|
|
|
|
//! This field will be `0` if its value cannot be determined. It can only be
|
|
|
|
|
//! determined for images that are loaded by dyld, so it will be `0` for the
|
|
|
|
|
//! main executable and for dyld itself.
|
|
|
|
|
time_t timestamp;
|
|
|
|
|
};
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
2018-02-22 12:12:26 -08:00
|
|
|
|
ProcessReaderMac();
|
2021-09-20 12:55:12 -07:00
|
|
|
|
|
|
|
|
|
ProcessReaderMac(const ProcessReaderMac&) = delete;
|
|
|
|
|
ProcessReaderMac& operator=(const ProcessReaderMac&) = delete;
|
|
|
|
|
|
2018-02-22 12:12:26 -08:00
|
|
|
|
~ProcessReaderMac();
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
|
|
|
|
//! \brief Initializes this object. This method must be called before any
|
|
|
|
|
//! other.
|
|
|
|
|
//!
|
|
|
|
|
//! \param[in] task A send right to the target task’s task port. This object
|
|
|
|
|
//! does not take ownership of the send right.
|
|
|
|
|
//!
|
|
|
|
|
//! \return `true` on success, indicating that this object will respond
|
|
|
|
|
//! validly to further method calls. `false` on failure. On failure, no
|
|
|
|
|
//! further method calls should be made.
|
2014-09-18 13:53:43 -04:00
|
|
|
|
bool Initialize(task_t task);
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
|
|
|
|
//! \return `true` if the target task is a 64-bit process.
|
2020-09-01 20:21:15 -04:00
|
|
|
|
#if defined(CRASHPAD_MAC_32_BIT_SUPPORT) || DOXYGEN
|
2014-08-25 17:51:09 -04:00
|
|
|
|
bool Is64Bit() const { return is_64_bit_; }
|
2020-09-01 20:21:15 -04:00
|
|
|
|
#else // CRASHPAD_MAC_32_BIT_SUPPORT
|
|
|
|
|
bool Is64Bit() const { return true; }
|
|
|
|
|
#endif // CRASHPAD_MAC_32_BIT_SUPPORT
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
|
|
|
|
//! \return The target task’s process ID.
|
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
|
|
|
|
pid_t ProcessID() const { return process_info_.ProcessID(); }
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
|
|
|
|
//! \return The target task’s parent process ID.
|
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
|
|
|
|
pid_t ParentProcessID() const { return process_info_.ParentProcessID(); }
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
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
|
|
|
|
//! \brief Determines the target process’ start time.
|
|
|
|
|
//!
|
2014-08-25 17:51:09 -04:00
|
|
|
|
//! \param[out] start_time The time that the process started.
|
2017-03-15 00:09:28 -04:00
|
|
|
|
void StartTime(timeval* start_time) const;
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
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
|
|
|
|
//! \brief Determines the target process’ execution time.
|
|
|
|
|
//!
|
2014-08-25 17:51:09 -04:00
|
|
|
|
//! \param[out] user_time The amount of time the process has executed code in
|
|
|
|
|
//! user mode.
|
|
|
|
|
//! \param[out] system_time The amount of time the process has executed code
|
|
|
|
|
//! in system mode.
|
|
|
|
|
//!
|
|
|
|
|
//! \return `true` on success, `false` on failure, with a warning logged. On
|
|
|
|
|
//! failure, \a user_time and \a system_time will be set to represent no
|
|
|
|
|
//! time spent executing code in user or system mode.
|
|
|
|
|
bool CPUTimes(timeval* user_time, timeval* system_time) const;
|
|
|
|
|
|
|
|
|
|
//! \return Accesses the memory of the target task.
|
2018-12-20 13:40:53 -08:00
|
|
|
|
const ProcessMemoryMac* Memory() const { return &process_memory_; }
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
2014-09-05 13:43:51 -04:00
|
|
|
|
//! \return The threads that are in the task (process). The first element (at
|
|
|
|
|
//! index `0`) corresponds to the main thread.
|
2014-09-05 16:35:16 -04:00
|
|
|
|
const std::vector<Thread>& Threads();
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
2014-09-05 13:43:51 -04:00
|
|
|
|
//! \return The modules loaded in the process. The first element (at index
|
|
|
|
|
//! `0`) corresponds to the main executable, and the final element
|
|
|
|
|
//! corresponds to the dynamic loader, dyld.
|
2014-09-05 16:35:16 -04:00
|
|
|
|
const std::vector<Module>& Modules();
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
mac: Handle _dyld_get_all_image_infos() not being available on 10.13
_dyld_get_all_image_infos() was only used in test code in Crashpad.
This addresses two related problems.
When running on 10.13 or later, _dyld_get_all_image_infos() is not
available. It appears to still be implemented in dyld, but its symbol is
now private. This was always known to be an “internal” interface. When
it’s not available, fall back to obtaining the address of the process’
dyld_all_image_infos structure by calling task_info(…, TASK_DYLD_INFO,
…). Note that this is the same thing that the code being tested does,
although the tests are not rendered entirely pointless because the code
being tested consumes dyld_all_image_infos through its own
implementation of an out-of-process reader interface, while the
dyld_all_image_infos data obtained by _dyld_get_all_image_infos() is
handled strictly in-process by ordinary memory reads. This is covered by
bug 187.
When building with the 10.13 SDK, no _dyld_get_all_image_infos symbol is
available to link against. In this case, access the symbol strictly at
runtime via dlopen() if it may be available, or when expecting to only
run on 10.13 and later, don’t even bother looking for this symbol. This
is covered by part of bug 188.
Bug: crashpad:185, crashpad:187, crashpad:188
Change-Id: Ib283e070faf5d1ec35deee420213b53ec24fb1d3
Reviewed-on: https://chromium-review.googlesource.com/534633
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-06-14 10:48:30 -04:00
|
|
|
|
//! \brief Determines the location of the `dyld_all_image_infos` structure in
|
|
|
|
|
//! the process’ address space.
|
|
|
|
|
//!
|
|
|
|
|
//! This function is an internal implementation detail of Modules(), and
|
|
|
|
|
//! should not normally be used directly. It is exposed solely for use by test
|
|
|
|
|
//! code.
|
|
|
|
|
//!
|
|
|
|
|
//! \param[out] all_image_info_size The size of the `dyld_all_image_infos`
|
|
|
|
|
//! structure. Optional, may be `nullptr` if not required.
|
|
|
|
|
//!
|
|
|
|
|
//! \return The address of the `dyld_all_image_infos` structure in the
|
|
|
|
|
//! process’ address space, with \a all_image_info_size set appropriately.
|
|
|
|
|
//! On failure, returns `0` with a message logged.
|
|
|
|
|
mach_vm_address_t DyldAllImageInfo(mach_vm_size_t* all_image_info_size);
|
|
|
|
|
|
2014-08-25 17:51:09 -04:00
|
|
|
|
private:
|
|
|
|
|
//! Performs lazy initialization of the \a threads_ vector on behalf of
|
|
|
|
|
//! Threads().
|
|
|
|
|
void InitializeThreads();
|
|
|
|
|
|
|
|
|
|
//! Performs lazy initialization of the \a modules_ vector on behalf of
|
|
|
|
|
//! Modules().
|
|
|
|
|
void InitializeModules();
|
|
|
|
|
|
|
|
|
|
//! \brief Calculates the base address and size of the region used as a
|
|
|
|
|
//! thread’s stack.
|
|
|
|
|
//!
|
|
|
|
|
//! The region returned by this method may be formed by merging multiple
|
|
|
|
|
//! adjacent regions in a process’ memory map if appropriate. The base address
|
|
|
|
|
//! of the returned region may be lower than the \a stack_pointer passed in
|
|
|
|
|
//! when the ABI mandates a red zone below the stack pointer.
|
|
|
|
|
//!
|
|
|
|
|
//! \param[in] stack_pointer The stack pointer, referring to the top (lowest
|
|
|
|
|
//! address) of a thread’s stack.
|
|
|
|
|
//! \param[out] stack_region_size The size of the memory region used as the
|
|
|
|
|
//! thread’s stack.
|
|
|
|
|
//!
|
|
|
|
|
//! \return The base address (lowest address) of the memory region used as the
|
|
|
|
|
//! thread’s stack.
|
|
|
|
|
mach_vm_address_t CalculateStackRegion(mach_vm_address_t stack_pointer,
|
|
|
|
|
mach_vm_size_t* stack_region_size);
|
|
|
|
|
|
|
|
|
|
//! \brief Adjusts the region for the red zone, if the ABI requires one.
|
|
|
|
|
//!
|
|
|
|
|
//! This method performs red zone calculation for CalculateStackRegion(). Its
|
|
|
|
|
//! parameters are local variables used within that method, and may be
|
|
|
|
|
//! modified as needed.
|
|
|
|
|
//!
|
|
|
|
|
//! Where a red zone is required, the region of memory captured for a thread’s
|
|
|
|
|
//! stack will be extended to include the red zone below the stack pointer,
|
|
|
|
|
//! provided that such memory is mapped, readable, and has the correct user
|
|
|
|
|
//! tag value. If these conditions cannot be met fully, as much of the red
|
|
|
|
|
//! zone will be captured as is possible while meeting these conditions.
|
|
|
|
|
//!
|
doc: Fix all Doxygen warnings, cleaning up some generated documentation
This makes Doxygen’s output more actionable by setting QUIET = YES to
suppress verbose progress spew, and WARN_IF_UNDOCUMENTED = NO to prevent
warnings for undocumented classes and members from being generated. The
latter is too noisy, producing 721 warnings in the current codebase.
The remaining warnings produced by Doxygen were useful and actionable.
They fell into two categories: abuses of Doxygen’s markup syntax, and
missing (or misspelled) parameter documentation. In a small number of
cases, pass-through parameters had intentionally been left undocumented.
In these cases, they are now given blank \param descriptions. This is
not optimal, but there doesn’t appear to be any other way to tell
Doxygen to allow a single parameter to be undocumented.
Some tricky Doxygen errors were resolved by asking it to not enter
directiores that we do not provide documentation in (such as the
“on-platform” compat directories, compat/mac and compat/win, as well as
compat/non_cxx11_lib) while allowing it to enter the
“off-platform” directories that we do document (compat/non_mac and
compat/non_win).
A Doxygen run (doc/support/generate_doxygen.sh) now produces no output
at all. It would produce warnings if any were triggered.
Not directly related, but still relevant to documentation,
doc/support/generate.sh is updated to remove temporary removals of
now-extinct files and directories. doc/appengine/README is updated so
that a consistent path to “goapp” is used throughout the file.
Change-Id: I300730c04de4d3340551ea3086ca70cc5ff862d1
Reviewed-on: https://chromium-review.googlesource.com/408812
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 14:23:09 -05:00
|
|
|
|
//! \param[in,out] start_address The base address of the region to begin
|
2014-08-25 17:51:09 -04:00
|
|
|
|
//! capturing stack memory from. On entry, \a start_address is the stack
|
|
|
|
|
//! pointer. On return, \a start_address may be decreased to encompass a
|
|
|
|
|
//! red zone.
|
doc: Fix all Doxygen warnings, cleaning up some generated documentation
This makes Doxygen’s output more actionable by setting QUIET = YES to
suppress verbose progress spew, and WARN_IF_UNDOCUMENTED = NO to prevent
warnings for undocumented classes and members from being generated. The
latter is too noisy, producing 721 warnings in the current codebase.
The remaining warnings produced by Doxygen were useful and actionable.
They fell into two categories: abuses of Doxygen’s markup syntax, and
missing (or misspelled) parameter documentation. In a small number of
cases, pass-through parameters had intentionally been left undocumented.
In these cases, they are now given blank \param descriptions. This is
not optimal, but there doesn’t appear to be any other way to tell
Doxygen to allow a single parameter to be undocumented.
Some tricky Doxygen errors were resolved by asking it to not enter
directiores that we do not provide documentation in (such as the
“on-platform” compat directories, compat/mac and compat/win, as well as
compat/non_cxx11_lib) while allowing it to enter the
“off-platform” directories that we do document (compat/non_mac and
compat/non_win).
A Doxygen run (doc/support/generate_doxygen.sh) now produces no output
at all. It would produce warnings if any were triggered.
Not directly related, but still relevant to documentation,
doc/support/generate.sh is updated to remove temporary removals of
now-extinct files and directories. doc/appengine/README is updated so
that a consistent path to “goapp” is used throughout the file.
Change-Id: I300730c04de4d3340551ea3086ca70cc5ff862d1
Reviewed-on: https://chromium-review.googlesource.com/408812
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 14:23:09 -05:00
|
|
|
|
//! \param[in,out] region_base The base address of the region that contains
|
2014-08-25 17:51:09 -04:00
|
|
|
|
//! stack memory. This is distinct from \a start_address in that \a
|
|
|
|
|
//! region_base will be page-aligned. On entry, \a region_base is the
|
|
|
|
|
//! base address of a region that contains \a start_address. On return,
|
|
|
|
|
//! if \a start_address is decremented and is outside of the region
|
|
|
|
|
//! originally described by \a region_base, \a region_base will also be
|
|
|
|
|
//! decremented appropriately.
|
doc: Fix all Doxygen warnings, cleaning up some generated documentation
This makes Doxygen’s output more actionable by setting QUIET = YES to
suppress verbose progress spew, and WARN_IF_UNDOCUMENTED = NO to prevent
warnings for undocumented classes and members from being generated. The
latter is too noisy, producing 721 warnings in the current codebase.
The remaining warnings produced by Doxygen were useful and actionable.
They fell into two categories: abuses of Doxygen’s markup syntax, and
missing (or misspelled) parameter documentation. In a small number of
cases, pass-through parameters had intentionally been left undocumented.
In these cases, they are now given blank \param descriptions. This is
not optimal, but there doesn’t appear to be any other way to tell
Doxygen to allow a single parameter to be undocumented.
Some tricky Doxygen errors were resolved by asking it to not enter
directiores that we do not provide documentation in (such as the
“on-platform” compat directories, compat/mac and compat/win, as well as
compat/non_cxx11_lib) while allowing it to enter the
“off-platform” directories that we do document (compat/non_mac and
compat/non_win).
A Doxygen run (doc/support/generate_doxygen.sh) now produces no output
at all. It would produce warnings if any were triggered.
Not directly related, but still relevant to documentation,
doc/support/generate.sh is updated to remove temporary removals of
now-extinct files and directories. doc/appengine/README is updated so
that a consistent path to “goapp” is used throughout the file.
Change-Id: I300730c04de4d3340551ea3086ca70cc5ff862d1
Reviewed-on: https://chromium-review.googlesource.com/408812
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 14:23:09 -05:00
|
|
|
|
//! \param[in,out] region_size The size of the region that contains stack
|
2014-08-25 17:51:09 -04:00
|
|
|
|
//! memory. This region begins at \a region_base. On return, if \a
|
|
|
|
|
//! region_base is decremented, \a region_size will be incremented
|
|
|
|
|
//! appropriately.
|
|
|
|
|
//! \param[in] user_tag The Mach VM system’s user tag for the region described
|
|
|
|
|
//! by the initial values of \a region_base and \a region_size. The red
|
|
|
|
|
//! zone will only be allowed to extend out of the region described by
|
|
|
|
|
//! these initial values if the user tag is appropriate for stack memory
|
|
|
|
|
//! and the expanded region has the same user tag value.
|
|
|
|
|
void LocateRedZone(mach_vm_address_t* start_address,
|
|
|
|
|
mach_vm_address_t* region_base,
|
|
|
|
|
mach_vm_address_t* region_size,
|
|
|
|
|
unsigned int user_tag);
|
|
|
|
|
|
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
|
|
|
|
ProcessInfo process_info_;
|
2014-09-05 16:35:16 -04:00
|
|
|
|
std::vector<Thread> threads_; // owns send rights
|
|
|
|
|
std::vector<Module> modules_;
|
2017-10-19 00:26:38 -04:00
|
|
|
|
std::vector<std::unique_ptr<MachOImageReader>> module_readers_;
|
2018-12-20 13:12:55 -08:00
|
|
|
|
ProcessMemoryMac process_memory_;
|
2014-09-18 13:53:43 -04:00
|
|
|
|
task_t task_; // weak
|
2014-08-25 17:51:09 -04:00
|
|
|
|
InitializationStateDcheck initialized_;
|
|
|
|
|
|
2020-09-01 20:21:15 -04:00
|
|
|
|
#if defined(CRASHPAD_MAC_32_BIT_SUPPORT)
|
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
|
|
|
|
// This shadows a method of process_info_, but it’s accessed so frequently
|
|
|
|
|
// that it’s given a first-class field to save a call and a few bit operations
|
|
|
|
|
// on each access.
|
2014-08-25 17:51:09 -04:00
|
|
|
|
bool is_64_bit_;
|
2020-09-01 20:21:15 -04:00
|
|
|
|
#endif // CRASHPAD_MAC_32_BIT_SUPPORT
|
2014-08-25 17:51:09 -04:00
|
|
|
|
|
|
|
|
|
bool initialized_threads_;
|
|
|
|
|
bool initialized_modules_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace crashpad
|
|
|
|
|
|
2018-02-22 12:12:26 -08:00
|
|
|
|
#endif // CRASHPAD_SNAPSHOT_MAC_PROCESS_READER_MAC_H_
|