1167 Commits

Author SHA1 Message Date
Mark Mentovai
8f0636288a Use constexpr at namespace scope
This is essentially based on a search for “^const .*=”.

Change-Id: I9332c1f0cf7c891ba1ae373dc537f700f9a1d956
Reviewed-on: https://chromium-review.googlesource.com/585452
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-07-29 01:06:52 +00:00
Mark Mentovai
6dac7ecdf5 Use constexpr at function scope
This is essentially based on a search for “^ *const [^*&]*=[^(]*$”

Change-Id: Id571119d0b9a64c6f387eccd51cea7c9eb530e13
Reviewed-on: https://chromium-review.googlesource.com/585555
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-07-29 00:50:40 +00:00
Mark Mentovai
7e6a0145b1 mac handler: Record the number of open files in the handler process
The "file-limit" annotation has shown that the system as a whole is not
likely to be out of file descriptors globally. It’s possible that a file
descriptor leak in crashpad_handler itself is responsible for certain
crashes. Add a count of the number of open files in the handler process
to this annotation to test this theory.

Bug: crashpad:180
Change-Id: If6f2304fdabddd29636ba4ac5a7d1e0fff7f4b61
Reviewed-on: https://chromium-review.googlesource.com/585852
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-07-26 17:21:45 +00:00
Mark Mentovai
281be63d00 Standardize on static constexpr for arrays when possible
This uses “static” at function scope to avoid making local copies, even
in cases where the compiler can’t see that the local copy is
unnecessary. “constexpr” adds additional safety in that it prevents
global state from being initialized from any runtime dependencies, which
would be undesirable.

At namespace scope, “constexpr” is also used where appropriate.

For the most part, this was a mechanical transformation for things
matching '(^| )const [^=]*\['.

Similar transformations could be applied to non-arrays in some cases,
but there’s limited practical impact in most non-array cases relative to
arrays, there are far more use sites, and much more manual intervention
would be required.

Change-Id: I3513b739ee8b0be026f8285475cddc5f9cc81152
Reviewed-on: https://chromium-review.googlesource.com/583997
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-07-25 17:40:51 +00:00
Joshua Peraza
01b347732e linux: Collect CPU times in ProcStatReader and use in ProcessReader
Bug: crashpad:30
Change-Id: I6d4020220031670937acad12d0b7878c1ae0fae7
Reviewed-on: https://chromium-review.googlesource.com/583952
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-25 04:15:32 +00:00
Mark Mentovai
90e4649f0d linux: Sort alphabetically in util .gyp files
Bug: crashpad:30
Change-Id: Iea992cd9eef1029c046cb354f7c1c0173b6f0675
Reviewed-on: https://chromium-review.googlesource.com/583767
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-07-24 18:51:31 +00:00
Joshua Peraza
9299d409ab linux: Refactor reading start time from the stat file
Bug: crashpad:30
Change-Id: Ie8137db2a5b6f2d4947df108d1fb5bdd9f8ab391
Reviewed-on: https://chromium-review.googlesource.com/580448
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-24 18:41:15 +00:00
Joshua Peraza
37f20f7b14 Add ThreadSnapshotLinux
Bug: crashpad:30
Change-Id: Iee8eaecadc4b8d61d3975a79fbc7f80dbb39a134
Reviewed-on: https://chromium-review.googlesource.com/580207
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-20 19:55:21 +00:00
Joshua Peraza
bde35ca918 Add MemorySnapshotLinux
Bug: crashpad:30
Change-Id: Iddd100c3806178f6d20dd903e3f41926904696d4
Reviewed-on: https://chromium-review.googlesource.com/577977
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-20 18:45:12 +00:00
Joshua Peraza
7be6b8ea1d Add functions to convert native x86 contexts to Crashpad CPUContexts
Debug registers are currently initialized to 0 until methods are added
to ThreadInfo to collect them.

Bug: crashpad:30
Change-Id: Ic1aab1151dcd4bed48eca8a60b76fb0d8d613418
Reviewed-on: https://chromium-review.googlesource.com/579889
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-20 18:16:11 +00:00
Joshua Peraza
6b5f139d88 linux: Add ProcessReader
ProcessReader is responsible for collecting information needed to build
a snapshot of the target process, independent of the Snapshot
interface. This CL includes implementation and tests for collecting
thread information, but does not yet collect module information.

Bug: crashpad:30
Change-Id: I911f155c953129a5fa8c031e923c0de2bd740ce0
Reviewed-on: https://chromium-review.googlesource.com/488162
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-19 18:16:09 +00:00
Joshua Peraza
5536baff13 linux: Use PTRACE_GET_THREAD_AREA for x86 ThreadInfo.GetThreadArea
Linux supports TLS on x86 by allocating slots in the GDT, accessible
via the system calls get/set_thread_area. This allows segment
registers (%gs on x86) to be used to quickly access the TLS.

Previously, we used PTRACE_GETREGSET with the NT_386_TLS regset. This
"register set" provides access to the subarray of the GDT used for TLS.
However, there are multiple slots provided and we don't know which one
is being used by the threading library for the current thread's TLS.
Previously, we were just using the first one, which worked for x86 on
64-bit kernels, but not 32-bit kernels. On 32-bit kernels, the first
slot ended up pointing to the TLS of the main thread.

The authoritative index of the current thread's TLS in the GDT is
given by bits 3-15 of %gs. However, this index cannot be used with
PTRACE_GETREGSET+NT386_TLS because we don't know the location of the
TLS slots in the GDT. PTRACE_GET_THREAD_AREA, however, accepts an
index from the start of the GDT similarly to get/set_thread_area.

Bug: crashpad:30
Change-Id: Ie6dfbdd088c6816fad409812a1a97037d4b38fd7
Reviewed-on: https://chromium-review.googlesource.com/575318
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-19 16:42:19 +00:00
Mark Mentovai
6ab73e0ad8 linux: #include appropriate headers for ElfImageReader
Bug: crashpad:30
Change-Id: I749a3493ec6a76dac904b36676330c5e487f356d
Reviewed-on: https://chromium-review.googlesource.com/571956
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-07-14 20:24:25 +00:00
Joshua Peraza
041a50d75c linux: Add DebugRendezvous to read dynamic linker data structures
Dynamic linkers use `struct r_debug` and `struct link_map` (defined in
`<link.h>`) to communicate lists of loaded modules to debuggers.

Bug: crashpad:30
Change-Id: Id903a1c199288dd85c34e38710cdb4c6b5fedb5b
Reviewed-on: https://chromium-review.googlesource.com/534853
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-14 19:07:05 +00:00
Joshua Peraza
a79791969d linux: Add MemoryMap::FindFileMmapStart
ELF executables and libraries may be loaded into memory in several
mappings, possibly with holes containing anonymous mappings
or mappings of other files. This method takes an input mapping and
attempts to find the mapping for file offset 0 of the same file.

Bug: crashpad:30
Change-Id: I79abf060b015d58ef0eba54a399a74315d7d2d77
Reviewed-on: https://chromium-review.googlesource.com/565223
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-11 16:19:48 +00:00
Joshua Peraza
4224be41d7 linux: Add ElfImageReader to read ELF images via ProcessMemory
Bug: crashpad:30
Change-Id: Id2a6a1868103b0f4374816e58aab365a977b010d
Reviewed-on: https://chromium-review.googlesource.com/508836
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2017-07-06 16:51:29 +00:00
Joshua Peraza
1c87c92932 linux: Add ProcessMemoryRange to restrict memory reads to a range
Bug: crashpad:30
Change-Id: I0debf3b47d0f79c5c5397e5ad2faf760191381ec
Reviewed-on: https://chromium-review.googlesource.com/553657
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-29 22:37:29 +00:00
Mark Mentovai
13e8672410 Update mini_chromium to ee67585e3115982282b86e210939ead1791e696d
ee67585e3115 linux: Switch between x86 and x86_64 with the target_arch
             GYP variable

Bug: crashpad:30
Change-Id: Ia7860cda42daae698a179b65d22ef7897141de59
Reviewed-on: https://chromium-review.googlesource.com/553557
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-06-28 21:50:42 +00:00
Mark Mentovai
3d6f7bcf90 Enable x86 optimizations for zlib
These were intended to be enabled previously, but GYP uses “ia32” and
“x64” for x86 and x86_64, and zlib.gyp erroneously used “x86” and
“amd64” instead.

In order to make this work, gcc and clang need -mpclmul to enable the
pclmul extension used by crc_folding.c. The optimized code will only be
used if, at runtime, SSE2, SSE4.2, and PCLMULQDQ support is detected.

Change-Id: Ic709cd2a6c38892083c44c4004573a64b3581eb5
Reviewed-on: https://chromium-review.googlesource.com/553337
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-06-28 20:20:36 +00:00
Mark Mentovai
6823f67830 Limit alignas to 64
Although GCC will silently accept larger alignments with
__attribute__((aligned())), it warn on alignas() with an alignment
larger than the target’s supported maximum. 8c35d92ae403 switched to
alignas() where possible.

The maxima are at least 128 on x86, x86_64, and arm64, and 64 on arm, in
the common configurations, but may be even larger with certain features
such as AVX enabled. These are ultimately derived from BIGGEST_ALIGNMENT
in gcc/config/*/*.h.

One alignment request in a test specified 1024 as a big alignment
constraint, solely as a test that alignment worked correctly. For this,
it’s perfectly reasonable to limit the alignment request to what GCC
supports on the most constrained target we’ll encounter.

Test: crashapd_util_test AlignedAllocator.AlignedVector
Change-Id: I42af443f437e01228934ab34dc04983742f0ab3f
Reviewed-on: https://chromium-review.googlesource.com/550236
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-06-27 17:49:29 +00:00
Mark Mentovai
376cddee9e doc: Update for NDK r15b
Change-Id: I5a9104d6dcfa74ce2aadd8f62dbef47e2d56d73f
Reviewed-on: https://chromium-review.googlesource.com/550355
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-06-27 16:00:59 +00:00
Mark Mentovai
a8493c9b31 android: Fix FloatContext::NativeFpxregs for x86 with unified headers
user_fxsr_struct is only used in traditional NDK headers. Unified
headers always use user_fpxregs_struct regardless of API level.

Bug: crashpad:30, b/63025548
Change-Id: Id9d350801e659673b136e6fb8c0cbbbeb6055c4b
Reviewed-on: https://chromium-review.googlesource.com/549376
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-06-27 14:23:48 +00:00
Mark Mentovai
f37b382687 linux/android: Reenable util test, and enable snapshot test
107fb7631788 added the snapshot library as a dependency of
crashpad_util_test. Most of snapshot has not yet been ported to Linux or
Android. snapshot/capture_memory.cc only supports x86 and x86_64, and
will #error on other CPUs. We don’t build for other CPUs on Mac or
Windows, but we do for Android.

To make it easy to run crashpad_util_test on non-x86 again,
conditionally remove capture_memory.cc on Linux and Android.

crashpad_snapshot_test can be enabled for Linux and Android too by
disabling the CrashpadInfoClientOptions tests which require OS support.
There’s not much left in crashpad_snapshot_test currently for Linux
except for CPUContextX86 and ProcessSnapshotMinidump.EmptyFile, but both
pass.

Bug: crashpad:30
Change-Id: Ic19a79932072710c69a296bc0156cbe5656b8cb3
Reviewed-on: https://chromium-review.googlesource.com/549116
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-06-27 14:23:14 +00:00
Mark Mentovai
7819ecbed6 posix: Use trunc() from <math.h> instead of std::trunc()
This folow-up to d2d10d1dc8f3 is for compatibility with 32-bit Android
platforms using NDK API 16.

isinf() is also caught up in the switch.

Change-Id: I652e27061c01afa3dd932f494cc4eeaca4236f40
Reviewed-on: https://chromium-review.googlesource.com/544238
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-06-22 20:54:26 +00:00
Mark Mentovai
d2d10d1dc8 posix: Use std::trunc() from <cmath> instead of trunc()
Change-Id: Ief90846020a4fea46e5008e8ddff5825d23ce8b9
Reviewed-on: https://chromium-review.googlesource.com/543216
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-06-21 15:23:39 +00:00
Joshua Peraza
bf52da0f1b posix: Fix Semaphore::TimedWait wait time
TimedWait is implemented using `sem_timedwait` which waits until an
absolute time (time since the epoch) has passed. Previously, the
time to wait (relative to now) was passed without adding the current
time.

Change-Id: I3c169d5b107b8263577c21a8f47dc504058bd708
Reviewed-on: https://chromium-review.googlesource.com/540984
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-21 08:47:38 +00:00
Mark Mentovai
b42854dfe1 Fix Doxygen after 8c802aace407
Change-Id: I9fe34c0a0322f327e7a69c831b11daa1cf835324
Reviewed-on: https://chromium-review.googlesource.com/541057
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-06-20 15:53:31 +00:00
Mark Mentovai
c4f6ca3c6a mac: Provide a larger thread state buffer for AVX-512 on 10.13
Crashpad doesn’t use AVX-512, but when receiving replies to exceptions
forwarded to ReportCrash, may see buffers large enough to contain
AVX-512 thread state. This can result in messages like
“UniversalExceptionRaise: (ipc/rcv) msg too large (0x10004004)”.

I386_THREAD_STATE_MAX has increased from 224 to 614 in the 10.13 SDK,
meaning that the maximum supported size for old_state and new_state in
[mach_]exception_raise_state[_identity]() has increased from 896 to
2,456 bytes. This constant defines the size of the buffer that these
MIG-generated routines will work with. By providing this definition in
compat, the buffer size is increased when building with older SDKs.

Note that on the “send” side, the size of the message given to
mach_msg() will be trimmed to include only the valid part of the state
area based on the stateCnt field, so increasing the value to 614 here
won’t result Crashpad sending messages this large. That would be a
potential interoperability concern with older OS versions.

Bug: crashpad:185, crashpad:190
Change-Id: Ia46091ae46fd6227a17f59eb4bc00914be471aa7
Reviewed-on: https://chromium-review.googlesource.com/541515
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-06-20 14:31:38 +00:00
Joshua Peraza
8c802aace4 Add ReinterpretBytes which does a checked, variable size bit cast
This renames and improves the VariableSizeBitCast helper from
util/linux/auxiliary_vector.* and moves it to misc.

Change-Id: I4bf46f4cfc0e60c900ff9bde467a21ad43c684cd
Reviewed-on: https://chromium-review.googlesource.com/534174
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-19 23:15:43 +00:00
Joshua Peraza
d3e4f09742 linux: Collect fxsave instead of fsave in ThreadInfo
Bug: crashpad:30
Change-Id: Ib4abf0ad60b792c8241b28e6b5e47970fdfcf451
Reviewed-on: https://chromium-review.googlesource.com/537532
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2017-06-16 16:16:00 +00:00
Mark Mentovai
63ccbd0e4c Remove compiler_specific.h #include from aligned_allocator.h
This was missed in Crashpad 8c35d92ae403. It syncs with Chromium
16289b3ef759.

Change-Id: I7e92e71fc940e25e751e7487d100b5684bdbf667
Reviewed-on: https://chromium-review.googlesource.com/535577
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-14 20:37:08 +00:00
Mark Mentovai
890ad441b3 mac: Accept modules in 10.13’s dyld shared cache
In 10.13, modules loaded from the dyld shared cache appear with __TEXT
segments that have a nonzero “fileoff” (file offset). Previously, the
fileoff was always 0. Previously, the fileoff for segments in the dyld
shared cache was the actual offset into the shared cache (not 0), but
special consideration was given to __TEXT segments which were forced to
0. See 10.12.4 dyld-433.5/interlinked-dylibs/OptimizerLinkedit.cpp
LinkeditOptimizer<>::updateLoadCommands(). Note the comment there where
the __TEXT segment’s apparent fileoff is set to 0:

// HACK until lldb fixed in: <rdar://problem/20357466>
// DynamicLoaderMacOSXDYLD fixes for Monarch dyld shared cache

Refer also to the lldb commit that references the above,
http://llvm.org/viewvc/llvm-project?view=revision&revision=233714.

Evidently, update_dyld_shared_cache has been revised to no longer apply
this hack in 10.13. Crashpad’s sanity check for __TEXT segments having a
fileoff of 0 is no longer valid, and causes it to reject modules loaded
from the dyld shared cache.

Since this was just a sanity check, remove it entirely.

This caused module information for modules loaded from the dyld shared
cache to be missing from minidumps produced on 10.13, which in turn
prevented symbolization in frames belonging to most system libraries.
For reasons not yet understood, I don’t see this problem in Chrome on
10.13db1 17A264c on a test virtual machine (HFS+ filesystem), although I
do see it on actual hardware (APFS filesystem), and I do see it in
Crashpad’s tests and reduced testcases on both as well.

Bug: crashpad:185, crashpad:189
Test: crashpad_snapshot_test MachOImageReader.Self_DyldImages:ProcessReader.SelfModules:ProcessReader.ChildModules:ProcessTypes.DyldImagesSelf
Change-Id: I8b0a22c55c33ce920804a879f6fab67272f3556e
Reviewed-on: https://chromium-review.googlesource.com/535576
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-06-14 19:49:44 +00:00
Mark Mentovai
6108d25232 mac: Update the process_types version of dyld_all_image_infos for 10.13
10.13 introduces two new fields to dyld_all_image_infos. Oddly, it
doesn’t put them in the “reserved” area that was defined in this
structure. This addition made it necessary for the padding problem in
the 32-bit structure previously worked around in Crashpad to be
addressed in the native structure, so Crashpad’s definition is adapted
to match.

This fixes tests on 10.13 that verify that dyld_all_image_infos can be
interpreted correctly.

Note that although the 10.13 SDK includes this structure extension,
numbered version 16, 10.13db1 17A264c continues to use version 15 as
used on 10.12, at least in crashpad_snapshot_test.

Bug: crashpad:185
Test: crashpad_snapshot_test ProcessTypes.DyldImagesSelf
Change-Id: I59a80c85bb234ef698c65a0ac5bbeac5b40fda77
Reviewed-on: https://chromium-review.googlesource.com/535394
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-06-14 18:44:17 +00:00
Mark Mentovai
107fb76317 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 15:08:05 +00:00
Mark Mentovai
2851e5cfc8 mac: Update cl_kernels workaround for macOS 10.13 (and later)
Since Apple closed https://openradar.appspot.com/20239912 without fixing
anything, it looks like we’ll be stuck with these quriky cl_kernels
modules for quite some time. Allow these modules to be tolerated on any
OS version >= 10.10, where they first appeared in a broken state, by
removing the upper bound for the OS version to tolerate with this quirk.

The tolerance was previously expanded to include 10.11 in
cd1f8fa3d2f2c76802952beac71ad85f51bbf771 and 10.12 in
6fe7c5414e46acfa30e8984513bf0896e91b9407. After this third update, this
should hopefully no longer be an annual exercise.

Bug: crashpad:185, crashpad:186
Change-Id: I66d409f2d1638bcf7601b6622f000be245230f34
Reviewed-on: https://chromium-review.googlesource.com/534253
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-06-13 19:47:59 +00:00
Mark Mentovai
f845797732 mac: 10.13 SDK compatibility, adapt to x86_state_hdr changes
In the 10.12 SDK, x86_state_hdr from <mach/i386/thread_status.h> was
defined as:

struct x86_state_hdr {
  int flavor;
  int count;
};

This has changed in the 10.13 SDK to:

struct x86_state_hdr {
  uint32_t flavor;
  uint32_t count;
};

This triggers signedness mismatch errors where these values are used
with CHECK/DCHECK macros and gtest EXPECT/ASSERT macros.

Compatibility with existing and new SDKs must be maintained, so more
casts must be used.

Bug: crashpad:185, crashpad:188
Change-Id: I8844d6a78520430a8b5b90a35403896c3c6cfa37
Reviewed-on: https://chromium-review.googlesource.com/533375
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-06-13 18:46:25 +00:00
Mark Mentovai
8c35d92ae4 Use the C++11-standardized alignof instead of ALIGNOF
Use the standard alignas instead of ALIGNAS in cases where this is
possible too. It’s not currently possible where ALIGNAS may be mixed
with other attributes, although the not-landed
https://codereview.chromium.org/2670873002/ suggests that where ALIGNAS
is mixed with __attribute__((packed)), it’s viable to write “struct
alignas(4) S { /* … */ } __attribute__((packed));”.

This includes an update of mini_chromium to
723e840a2f100a525f7feaad2e93df31d701780a, picking up:

723e840a2f10 Remove ALIGNOF

This tracks upstream https://codereview.chromium.org/2932053002/.

Change-Id: I7ddaf829020ef3be0512f803cecbb7c543294f07
Reviewed-on: https://chromium-review.googlesource.com/533356
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-06-13 18:33:35 +00:00
Joshua Peraza
1c0c305bc9 linux: Add FindMappingWithName to MemoryMap
Bug: crashpad:30
Change-Id: I5e03dc14e3cd1e09ac45cba97922499ec48ea389
Reviewed-on: https://chromium-review.googlesource.com/532753
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-13 16:00:01 +00:00
Joshua Peraza
8e2e805fa5 linux: Add AuxiliaryVector for reading other process' aux vectors
Bug: crashpad:30
Change-Id: Ief19be7d60decb17f159b3d740ac9d15a034b807
Reviewed-on: https://chromium-review.googlesource.com/526533
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-12 20:20:42 +00:00
Scott Graham
dbc229a2d7 Update mini_chromium to 606ff8a3
> git log --oneline ef0ded87..606ff8a3
606ff8a Remove base/memory/aligned_memory.*

Change-Id: Id3b1b75f2e18437543dc4703f6b2dc578ac7fa75
Reviewed-on: https://chromium-review.googlesource.com/530071
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-06-09 21:50:59 +00:00
Joshua Peraza
8fb23f2acc linux: Provide ThreadInfo to collect register sets with ptrace
ThreadInfo provides a uniform interface to collect register sets or
the thread-local storage address across bitness for x86 and ARM family
architectures. Additionally, ThreadInfo.h defines context structs which
mirror those provided in sys/user.h. This allows tracing across bitness
as the structs in sys/user.h are only provided for a single target
architecture.

Bug: crashpad:30
Change-Id: I91d0d788927bdac5fb630a6ad3c6ea6d3645ef8a
Reviewed-on: https://chromium-review.googlesource.com/494075
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-01 19:25:06 +00:00
Mark Mentovai
5ebd24e96e Upload to the production Chromium Gerrit instance, not the canary
Change-Id: Iad3bf52ba5f7babb1c6b3508fc034ab78949967d
Reviewed-on: https://chromium-review.googlesource.com/509933
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-05-19 20:56:57 +00:00
Mark Mentovai
f53f2c84cc Fix comments identifying the source of module TimeDateStamp information
Change-Id: I164f0208db103410c3133a67a994a4f603ce1b27
Reviewed-on: https://chromium-review.googlesource.com/494827
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-05-03 21:13:05 +00:00
Pierre-Antoine Manzagol
7d56fd2386 Rely on winsock2.h for timeval
Bug: crashpad:
Change-Id: Iee8ebfaf7c4a1e8e87fcfcbc6ee8a4529a2f7c52
Reviewed-on: https://chromium-review.googlesource.com/493893
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Pierre-Antoine Manzagol <manzagop@chromium.org>
2017-05-03 17:53:45 +00:00
Mark Mentovai
1969a5d758 Document who has access to the try server and commit queue
Drop the text recommending the PolyGerrit UI, since it is now the
default Gerrit UI.

Bug: chromium:717982
Change-Id: I7041ee51670a7a18b510ed7a55045cc2eb09983e
Reviewed-on: https://chromium-review.googlesource.com/494726
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-05-03 17:49:24 +00:00
Mark Mentovai
d9ca2ad21f Give group project-crashpad-tryjob-access access to the commit queue
Bug: chromium:717982
Change-Id: I826f7520409656f5f549a110895e46de111d17f4
Reviewed-on: https://chromium-review.googlesource.com/494666
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-05-03 16:00:30 +00:00
Mark Mentovai
dc60e106f3 linux: Make fewer (but still a lot of) regions in MemoryMap’s test
The lots-of-regions tests in the MemoryMap test case were very
time-consuming, particularly in debug mode. MemoryMap.MapRunningChild
took as long as 15 seconds on-device (Nexus 5X), and the best result was
in the neighborhood of 7 seconds.

The bulk of the time spent in these tests was in ExpectMappings(), which
calls MemoryMap::FindMapping() in a loop to verify each region. Each
call to FindMapping() traverses the MemoryMap (internally, currently
just a std::vector<>) from the beginning. With the need to verify 4,096
regions, a single call to ExpectMappings() had to perform over 8,000,000
checks to find the regions it needed. In turn, ExpectMappings() is
called once by the SelfLargeMapFile test, and eight times by
MapRunningChild. By reducing the number of regions to 1,024, each call
to ExpectMappings() needs to perform “only” fewer than 600,000 checks.

After this change, MemoryMap.MapRunningChild completes in about a half a
second on-device.

https://crashpad.chromium.org/bug/181 is concerned with implementing a
RangeMap to serve MemoryMap and other similar code. After that’s done,
it, it should be feasible to raise the number of regions used for these
tests again.

Bug: crashpad:30, crashpad:181
Test: crashpad_util_test MemoryMap.SelfLargeMapFile:MemoryMap.MapRunningChild
Change-Id: I8ff88dac72a63c97ac937304b578fbe3b4ebf316
Reviewed-on: https://chromium-review.googlesource.com/494128
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-05-02 21:18:53 +00:00
Mark Mentovai
abbeffead9 Fix file descriptor/handle leak in LoggingReadEntireFile()
8af3203d811c introduced a resource leak.

Change-Id: Ia909eef39b6b772d8808dd6f5770c06add6467bc
Reviewed-on: https://chromium-review.googlesource.com/493946
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-05-02 19:50:28 +00:00
Joshua Peraza
51779ce639 linux: Make MemoryMap retry when duplicates are detected
When the /proc/pid/maps file is not read atomically and the target
process is actively mapping memory, entries can be read multiple times
or missed entirely. This change makes MemoryMap read the whole contents
of the maps file before attempting to parse it as well as check for
duplication/overlap errors, retrying on failure. This change also adds
ptrace attachements to unit tests to reflect actual intended usage.

Bug: crashpad:30
Change-Id: Ie8549548e25c47baa418ee7439d82743f84ff41e
Reviewed-on: https://chromium-review.googlesource.com/491950
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2017-05-02 17:28:31 +00:00
Joshua Peraza
8af3203d81 Add LoggingReadEntireFile for reading a file into a string
Change-Id: Ie07ef12131ef1d995aa78749091f3adacde75160
Reviewed-on: https://chromium-review.googlesource.com/492446
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-05-02 04:01:48 +00:00