497 Commits

Author SHA1 Message Date
Scott Graham
4a34a3dd89 win: Make reading NT_IMAGE_HEADERS work cross-bitness
Factor out some test launching code used in cross-bitness tests.

R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1352323002 .
2015-09-20 11:16:31 -07:00
Scott Graham
bf556829d9 win: support x64 reading x86 (wow64)
Removes the bitness-specific targets in favour of pulling binaries from
the other build directory. This is to avoid the added complexity of
duplicating all the targets for the x86 in x64 build.

Overall, mostly templatizing more functions to support the
wow64-flavoured structures. The only additional functionality required
is reading the x86 TEB that's chained from the x64 TEB when running
as WOW64.

The crashing child test was switched to a manual CreateProcess because
it needs to launch a binary other than itself.

R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1349313003 .
2015-09-18 16:06:05 -07:00
Mark Mentovai
00a422357d Update GYP to 01528c7244837168a1c80f06ff60fa5a9793c824
8c31354f5e0c Fix mixed line endings warning
4f4c7cb5a63e Add TestGypXcodeNinja to run tests against the xcode-ninja
             generator
f1dc682b70a6 Fix: xcode-ninja should generate Xcode workspace into
             generator_output
cdf037c1edc0 Fix: xcode-ninja should copy the product extension to the
             wrapper project
82b08049cc0b Set ZERO_AR_DATE=1 when running libtool.
8b69f7d23df5 Add support for generating an Eclipse .classpath file (bug
             fix)
789a019a8320 Don't serialize linking for the make generator by default
194ec65a55ed Revert 2011 'Fixed Gyp Xcode generator for libraries with
             identical names.'
91a89564da3d Add 'depfile' option to actions.
3dde7bfb50a6 don't assume bash is installed
28384e55a5c8 msvs/ninja win: Fix support for
             ImageHasSafeExceptionHandlers
adb7d24b9fc1 Revert "msvs/ninja win: Fix support for
             ImageHasSafeExceptionHandlers"
b28bd7ddd143 win: 'EnableEnhancedInstructionSet': '5' now enables
             /arch:AVX2.
104e21ecf6f2 mac: Followup to ZERO_AR_DATE, touch the -o archive,
             rather than expecting only one
4d7c139b1820 win: Add NoImportLibrary flag for ninja generator
67000714d51e Reland "msvs/ninja win: Fix support for
             ImageHasSafeExceptionHandlers"
16f9f4566f5d msvs: Prefer x64 toolset if we are running on 64-bit
6194e32f7fcb Make msvs-ninja work for target-arch=x64
34640080d08a ninja/posix: Introduce support for arflags variable.
7cd601835636 Updating gyp repo for git, preparing for cq.
dd831fd86e7a Fix script url.
a5bd08f28629 Adds the ability for 'copies' in Xcode project files to
             specify the 'Code Sign on Copy' option.
002ebe4420a3 Fixed version of https://codereview.chromium.org/748793002
50ab31edc847 Fix typo in ternary operator.
4a9b712d5cb4 Fix gyp analyzer generator on mac.
d9823985797f Convert plist and strings to binary for iOS.
28c00336a403 Bump Xcode compatibility version from 45 (Xcode 2.4-3.1) to
             46 (Xcode 3.2).
2cd9d0633c96 [ninja-xcode] Include action inputs in hybrid builds.
d174d75bf69c Export generator flavor to gyp scripts
2b44e5987d5a Add missing identity variables to gypd generator.
e1c8fcf74b68 Assert when source is an absolute path
c5859a298166 Migrate GYP docs over from the wiki.
69dfb493a22f LLVM_LTO support for make / ninja
2889664b9fa8 Address scottmg comments from
             https://codereview.chromium.org/1003273007/.
2a5511bd901f Improve generated Makefile rules for rules several outputs.
2f66a3f94953 Whitespace change to test the new GYP waterfalls.
3601f26003c6 Make dump_dependency_json.py write <| list files to the
             output directory rather than the source tree.
8866260996c0 win: prefer amd64_x86 compiler on >= 2013, not just 2013
0bb67471bca0 Slightly better docs for git instead of svn
f34b9aa7c9d6 Remove the Android generator.
9f594095c5b1 Added msvs_application_type_revision for winrt compilation
c0cf1f22eb42 Revert "Stop checking for duplicate basenames"
4dd5d3c614fb Update shared_library test after c0cf1f22eb
29e94a3285ee Avoid lint presubmit error in dump_dependency_json
08429da7955a Update cmake generator to handle Skia Android build.
aa537916dcb5 msvs: Make sure stdout/stderr from rule commands get logged
fdc7b812f99e Makes analyzer always output static_libraries that have
             changed
79de4031069f Fix gyp->make translation of rules with several outputs.
9b2b25aececd Correct braces in input format reference doc.
b4781fc38236 MSVS: Normalize paths against gyp directory.
127b311bf61d Adds some debugging output to analyzer
fdcd8bc10c93 More debugging for analyzer
acfc10d29072 Revert "MSVS: Normalize paths against gyp directory."
5122240c5e5c Fix support for iOS today extensions on latest Xcode beta.
ae276266d580 Make DependencyGraph.DeepDependencies() depth-first.
25ed9ac4ac2a Do not remote duplicate entries from ldflags when
             generating ninja files as it changes behavior
6ee91ad86598 Reduce DefaultConcurrentLinks from phys/4GB to phys/5GB.
658f3a81995b Disable currently failing gyp tests on win to make the bots
             green.
479dacf7be5f Disable GYP tests currently failing on the Mac bot
36d99ff23099 Disable test/win/gyptest-link-defrelink.py
d6adc48df899 Fix the default tryserver lists in PRESUBMIT.py.
81c2e5ff92af Added msvs_target_platform_version and
             msvs_target_platform_minversion for winrt compilation
010fb9d696e7 msvs_emulation: Add support for StackReserveSize and
             StackCommitSize
edccc7bad7da Analyzer didn't match correctly targets that defined path
             to inputs with '.' relative path values. So let normalize
             path before matching.
bae26e800c7f Inject pylib first in the path. This ensures that test load
             the version of pylib in this repo, not elsewhere on the
             system.
008cf1c04393 Improve error messages when <!(commands) fail
121d89dfcd4f Make RelativePath use abspath rather than realpath for the
             'path' variable. This allows gyp to work correctly in
             symlink-heavy environments. Basically, this is because gyp
             paths need to be in a consistent tree, so we need to
             compute a path to the target within the *stated* tree, even
             if it is not the real underlying path to the target. The
             'relative_path' variable does need to be resolved using
             realpath, since gyp or the underlying build system might cd
             to it before looking for the 'path' target.
2b17e0b26a93 Fix paths with different seperators being compared in the
             analyzer on Windows.
5d01a8cda53b Revert "Make RelativePath use abspath rather than realpath
             for the 'path' variable."
1f374df95de1 Make sure GYP supports compiling managed code.
cf3170e30578 Update gyp LINK_COMMANDS_AIX to support both 32-bit and
             64-bit files. * cmd_alink: Add -X32_64 option. *
             cmd_alink_thin: Add -X32_64 option.
01528c724483 Fallback to '.tbd' for system missing '.dylib'.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1358583003 .
2015-09-18 19:02:17 -04:00
Scott Graham
96f687b567 win: remove unused fields from CrashpadInfo
These were made unnecessary after changing how registration works, but I
forgot to actually delete them from CrashpadInfo.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1357753002 .
2015-09-18 15:19:51 -07:00
Mark Mentovai
9b9e49d0d9 Remove unnecessary crashpad:: qualification from implicit_cast<>
This undoes 595803e1be18, a workaround that should no longer be
necessary now that base no longer provides implicit_cast<> in the global
namespace.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1356673003 .
2015-09-17 13:11:23 -04:00
Mark Mentovai
4ff6c2d71f Remove #include "base/basictypes.h" as appropriate
These files were only using basictypes.h for implicit_cast, which moved
to util/misc/implicit_cast.h in 0b022d72a2a4.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1352873002 .
2015-09-17 12:32:38 -04:00
Scott Graham
bf94f98ecc Roll mini_chromium to 302e4e7d9aa0a8d39ad62b193a4c8a8357ad9d0c
Pulls in "win: Don't omit frame pointers".

TBR=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1348883003 .
2015-09-16 14:35:28 -07:00
Scott Graham
8ce88d8953 win x86: Grab bag of restructuring to get tests working on x86-on-x86
A few function implementations that were missing, various switches
for functions/functionality that didn't exist on XP, and far too long
figuring out what exactly was wrong with SYSTEM_PROCESS_INFORMATION
on x86 (the "alignment_for_x86" fields).

R=mark@chromium.org
BUG=crashpad:1, crashpad:50, chromium:531663

Review URL: https://codereview.chromium.org/1336823002 .
2015-09-16 12:42:20 -07:00
Scott Graham
bc55c7916e win: Add (currently unused) NTSTATUS_LOG
Split out of https://codereview.chromium.org/1336823002/, I'll go and
adapt various places to use it as I need to touch them.

R=mark@chromium.org
BUG=crashpad:1, crashpad:50

Review URL: https://codereview.chromium.org/1343873003 .
2015-09-15 09:22:29 -07:00
Scott Graham
595803e1be In the launch.mm file use the crashpad::implicit_cast .. explicitly.
Until the base one goes away this complains of it being ambiguous.

R=mark@chromium.org, scottmg@chromium.org
BUG=529769, 472900, crashpad:51

Review URL: https://codereview.chromium.org/1336413003 .
2015-09-14 15:17:51 -07:00
Scott Graham
4f3f1b68d5 Roll mini_chromium to 71c2f4d01e52aa0e2fb9bf6118f147905e50e284
Removes basictypes.h implicit_cast.

TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/1345603002 .
2015-09-14 15:12:08 -07:00
Scott Graham
0b022d72a2 Include implicit_cast.h at all users of it.
The implicit_cast in base will be no more, make sure we have a reference
to the crashpad version at all callsites.

BUG=529769, 472900, crashpad:51
R=mark@chromium.org, scottmg@chromium.org

Review URL: https://codereview.chromium.org/1344683002 .
2015-09-14 14:51:05 -07:00
Scott Graham
5069c2903a Replace implicit_cast usage with static_cast.
chromium's implicit_cast is going to be removed so stop using it.

BUG=529769,472900
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1335353002 .
2015-09-14 11:09:46 -07:00
Scott Graham
6c23e37ee9 win: Fix ProcessInfo test when running on x86 host OS
R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1339813002 .
2015-09-14 11:07:59 -07:00
Scott Graham
c3cc1d19c1 win: Fix use of THREAD_ALL_ACCESS on XP
OpenThread(THREAD_ALL_ACCESS, ...) fails on XP with the uplevel value of
THREAD_ALL_ACCESS, so use the XP value.

Similar to the PROCESS_ALL_ACCESS in
https://codereview.chromium.org/1337133002/ but I mistakenly only
grepped for PROCESS_ALL_ACCESS at that point.

R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1337653005 .
2015-09-11 16:45:44 -07:00
Scott Graham
d62866f734 win: Don't run x64 specific test unless built for x64
R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1343433003 .
2015-09-11 16:11:00 -07:00
Scott Graham
81269ee676 win: Fix pipe leak on connection
The pipe handle was being leaked on connections (oops!). On XP this
resulted in the next test's CreateNamedPipe to fail, because the
previous one still existed (because all handles were not closed). More
recent OSs are more forgiving so I got away with the buggy code.

R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1337953003 .
2015-09-11 15:34:35 -07:00
Scott Graham
ccf9f98519 win xp: Don't use ICU_REJECT_USERPWD with WinHttpCrackUrl
Fails on XP with ERROR_INVALID_PARAMETER (undocumented). Not overly
important that we reject embedded user/passwords in the URL for this
use case.

R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1339793002 .
2015-09-11 13:23:59 -07:00
Scott Graham
3a886267aa win: Fix OpenProcess(PROCESS_ALL_ACCESS, ...) on XP
PROCESS_ALL_ACCESS was changed in later SDKs and the newer value fails
when run on XP with ERROR_ACCESS_DENIED. Use the old value to maintain
compatibility with XP.

R=mark@chromium.org
BUG=crashpad:50

Review URL: https://codereview.chromium.org/1337133002 .
2015-09-11 13:16:06 -07:00
Mark Mentovai
1678e1a3ac capture_context_mac (32-bit x86): Comments and code should agree more
It looks like I wrote the x86_64 version first and didn’t adapt
everything perfectly when transitioning to 32-bit x86. This shouldn’t
affect anything functionally.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1332913002 .
2015-09-10 15:15:19 -04:00
Scott Graham
d7f90b45b6 win: Fix incorrect thread suspend count due to ScopedProcessSuspend
After https://codereview.chromium.org/1303173011/, the thread suspend
count would be one too large because the count is adjusted when the
process is suspended. Counteract this by passing in whether the
process is suspended or not so that the thread's suspension count
can be adjusted.

Add a test to sanity-check thread suspend count.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/1326443007 .
2015-09-09 12:29:29 -07:00
Scott Graham
5111a1823f win: Implement and use ScopedProcessSuspend
R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1303173011 .
2015-09-08 10:09:26 -07:00
Scott Graham
28c5da9080 win: Add version to client registration request
Follow up after suggestion in https://codereview.chromium.org/1301853002/.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1314683008 .
2015-09-04 11:52:07 -07:00
Mark Mentovai
1c7843bd44 Fix relative path in crashpad_handler.ad
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1325343003 .
2015-09-04 14:51:32 -04:00
Mark Mentovai
9086d25ce8 Don’t trigger EXC_CORPSE_NOTIFY on OS X 10.11
CrashReportExceptionHandler::CatchMachException() must always set a
valid new_state. Failing to do so appears to trigger corpse generation
on OS X 10.11. This is addressed by calling ExcServerCopyState().
Previously, this was not done for exceptions forwarded to the user
ReportCrash, under the apparent mistaken assumption that ReportCrash
would do it. However, ReportCrash is given copies of out-parameters like
new_state to explicitly prevent it from influencing Crashpad’s returned
state.

ExcServerSuccessfulReturnValue() must not return MACH_RCV_PORT_DIED for
an EXC_CRASH handler on OS X 10.11. This appears to trigger corpse
generation. This is addressed by always returning KERN_SUCCESS from
EXC_CRASH handlers on OS X 10.11.

This also adds generic EXC_CORPSE_NOTIFY support throughout Crashpad.
The crashpad_handler does not listen for this exception type, but it is
now possible to work with this exception type using tools like
exception_port_tool and catch_exception_tool.

BUG=crashpad:48
TEST=Crashes handled by crashpad_handler do not result in the generation
     of reports in the root /Library/Logs/DiagnosticReports.

R=kerrnel@chromium.org, rsesek@chromium.org

Review URL: https://codereview.chromium.org/1305893010 .
2015-09-04 14:29:12 -04:00
Scott Graham
5de461e8c8 Refactor handler/main for Windows, implement CrashHandlerExceptionServer
BUG=crashpad:1
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1314093002 .
2015-09-03 13:31:19 -07:00
Scott Graham
6978bf7646 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
Scott Graham
754cc3609c win x86: a few trivial compile fixes when GYP_DEFINES=target_arch=ia32
(CL to add x86 bots to waterfall in progress too.)

R=mark@chromium.org
BUG=crashpad:49

Review URL: https://codereview.chromium.org/1325173002 .
2015-09-02 18:35:19 -07:00
Scott Graham
3ef04d14f2 Implement ModuleSnapshotWin::UUID
Reads CodeView PDB GUID from Debug Directory of PE header.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1311003003 .
2015-09-01 09:32:09 -07:00
Scott Graham
78bba8808b win: Pass WINHTTP_FLAG_SECURE when necessary
Otherwise the server drops us when connecting to an https endpoint,
and WinHttpReceiveResponse fails with an obscure error.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1317023003 .
2015-08-31 13:29:00 -07:00
Mark Mentovai
f21b740171 asan: Don’t pad the CrashpadInfo struct with a red zone
MachOImageReader::GetCrashpadInfo() expects the CrashpadInfo struct to
be the only thing in a __DATA,__crashpad_info section, and enforces this
by checking that the section’s size matches the size declared in the
struct’s size_ field.

Under AddressSanitizer, a red zone follows the structure. While not
reflected in the size of the structure, it is reflected in the size of
the section, causing MachOImageReader::GetCrashpadInfo() to reject the
CrashpadInfo on the assumption that something else is present in the
section.

By specifying an alignment greater than the minimum red zone size of 32
bytes, red zone generation can be suppressed.

TEST=crashpad_snapshot_test
BUG=crashpad:44
R=glider@chromium.org, rsesek@chromium.org

Review URL: https://codereview.chromium.org/1296523003 .
2015-08-20 14:10:42 -04:00
Mark Mentovai
b70d302987 Add a few more expectations to crashpad_util_test InRangeCast
TEST=crashpad_util_test InRangeCast.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1300403002 .
2015-08-20 12:13:46 -04:00
Mark Mentovai
34aef02cc7 ubsan: Don’t call v[0] on empty vectors
Calling std::vector<>::operator[]() with an out-of-range index argument
is undefined behavior. In two cases, Crashpad used &v[0] in situations
where it was known that the address would not be used. These calls were
wrapped in conditions guarding against vector emptiness.

While s[0] is valid on an empty string, in two cases, Crashpad used
&s[0] as an argument to a system call that would be a no-op. These calls
were wrapped in similar conditions to avoid the system call.

The two uses of vector with undefined behavior were caught by the
following tests in crashpad_snapshot_test with
UndefinedBehaviorSanitizer:

[ RUN      ] CrashpadInfoClientOptions.OneModule
/Users/mark/compilatorium/llvm.build/bin/../include/c++/v1/vector:1493:12:
runtime error: reference binding to null pointer of type
'crashpad::process_types::section'
[       OK ] CrashpadInfoClientOptions.OneModule (72 ms)

[ RUN      ] ProcessSnapshotMinidump.Empty
/Users/mark/compilatorium/llvm.build/bin/../include/c++/v1/vector:1493:12:
runtime error: reference binding to null pointer of type
'MINIDUMP_DIRECTORY'
[       OK ] ProcessSnapshotMinidump.Empty (1 ms)

The Crashpad codebase was audited by searching for resize() calls and
analyzing how resized strings and vectors are used.

TEST=*
BUG=
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1283243004 .
2015-08-20 11:50:19 -04:00
Mark Mentovai
5064aeb784 Use -[NSNumber numberWithDouble:] for doubles
Found by -fsanitize=undefined:
[ RUN      ] Launchd.CFPropertyToLaunchData_FloatingPoint
../../../util/mac/launchd_test.mm:82:33: runtime error: value
1.79769e+308 is outside the range of representable values of type
'float'
[       OK ] Launchd.CFPropertyToLaunchData_FloatingPoint (2 ms)

TEST=crashpad_util_test Launchd.CFPropertyToLaunchData_FloatingPoint
BUG=
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1302843004 .
2015-08-20 09:29:23 -04:00
Mark Mentovai
899821d4c7 Fix -Winconsistent-missing-override in CrashReportUploadThread
Chromium builds with a newer clang than the Crashpad buildbot, and it
reports:

../../../handler/crash_report_upload_thread.cc:148:16: error: 'ThreadMain' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  virtual void ThreadMain() {
               ^
../../../util/thread/thread.h:46:16: note: overridden virtual function is here
  virtual void ThreadMain() = 0;
               ^
1 error generated.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1302833002 .
2015-08-19 22:41:46 -04:00
Mark Mentovai
3b6e5613cb asan: Bypass the “nearby PC” check
Under asan, there are many more instructions than without. The “nearby
PC” check is much less useful, and would likely fail.

TEST=crashpad_client_test CaptureContext.CaptureContext
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1298943003 .
2015-08-19 18:50:15 -04:00
Mark Mentovai
b1d7833600 Use EXPECT_STREQ(a, b) when a and b are both const char*
While not strictly asan-related, this bug was found while running tests
under asan. Evidently, strings are pooled differently in that build
configuration.

TEST=crashpad_util_test ExceptionPorts.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1291573004 .
2015-08-19 18:47:51 -04:00
Mark Mentovai
6645a69240 asan: Fix invalid memory access in UniversalExceptionRaise()
TEST=crashpad_util_test ExcClientVariants.UniversalExceptionRaise
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1283323010 .
2015-08-19 18:47:02 -04:00
Scott Graham
4f2d2018de Fix port of CrashReportUploadThread to windows
util/thread/ doesn't automatically start, contrary to previous pthread
implementation.

Thanks to mihnea@arkaos.net for the patch.

R=mark@chromium.org
BUG=https://codereview.chromium.org/1295363002/#msg5

Review URL: https://codereview.chromium.org/1286383006 .
2015-08-19 09:41:46 -07:00
Scott Graham
86419cf788 Port CrashReportUploadThread to Windows
Just a simple port now that we have a common Thread class.
Compiled but not yet in use on Windows.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1295363002 .
2015-08-18 15:34:10 -07:00
Mark Mentovai
14a2241274 HTTPTransport test: Deal with limited-size pipe buffers
HTTPTransport.Upload33k failed on Windows due to WinHTTP timing out. The
test server, http_transport_test_server.py, writes the entire request to
a stdout pipe, to be received by crashpad_util_test. crashpad_util_test
is also the HTTP client, and it does not attempt to read from this pipe
until the HTTP transaction is complete. http_transport_test_server.py
must not write to stdout until the transaction is complete, otherwise,
there is a risk of deadlock if the pipe buffer fills up. The new
Upload33k test sends a large request, which was filling up the pipe
buffer on Windows.

This also adds an Upload33k_LengthUnknown test variant to exercise a
large POST when the length is not known ahead of time. This more closely
matches how Crashpad crash uploads are done on OS X.

TEST=crashpad_util_test HTTPTransport.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1286173007 .
2015-08-18 17:52:12 -04:00
Scott Graham
397e437e51 Add 'tags' to .gitignore
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1287303004 .
2015-08-18 13:07:06 -07:00
Mark Mentovai
f496130fd5 HTTPTransportMac: CFStream Read() must always set at_eof
CFStream’s CFReadStreamGetBuffer() calls the Read() callback without
initializing at_eof. The callback function is responsible for setting it
on any successful read operation. See 10.10.2 CF-1152.14/CFStream.c.

By chance, at_eof seems to always have an initial value of false on
x86_64, but true on 32-bit x86. Crashpad’s Read() callback assumed that
the initial value was always false. The discrepancy caused truncation
and possibly hangs when a 32-bit process attempted to upload a request
body larger than 32kB, the buffer size used by NSMutableURLRequest or
something between it and CFReadStream.

A new test with more than 32kB of data is added.

As discussed in:
https://groups.google.com/a/chromium.org/d/topic/crashpad-dev/Vz--qMZJRPU

TEST=crashpad_util_test HTTPTransport.Upload33k
BUG=
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1304433004 .
2015-08-18 15:42:34 -04:00
Scott Graham
a691448ffb win: Implement exception snapshot
Refactor some of the NT internals helpers and cpu_context to share
between the thread and exception snapshot code.

Add test that runs crashing child and validates the exception in the
snapshot.

R=mark@chromium.org, cpu@chromium.org, rsesek@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1126413008 .
2015-08-18 12:25:19 -07:00
Scott Graham
1a770c8237 Implement more of CrashpadClient on Windows
SetHandler connects to RegistrationServer as a handler,
and catching an exception writes EXCEPTION_POINTERS to
CrashpadInfo.

R=cpu@chromium.org, mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1287073002 .
2015-08-14 15:22:09 -07:00
Mark Mentovai
e74922936d Check the size of of the dyld_all_image_infos structure before using it
After 6083a2706d55, it is possible to determine the expected size of a
versioned structure such as dyld_all_image_infos. The expected size is
compared against the actual size of the structure as returned by
task_info() (TASK_DYLD_INFO).

TEST=crashpad_snapshot_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1272283004 .
2015-08-13 12:55:41 -04:00
Nick Carter
ad09fd1bc8 DCHECK_IS_ON needs ()
Found in the course of reintroducing this bug elsewhere

R=danakj@chromium.org, mark@chromium.org

Review URL: https://codereview.chromium.org/1287043005 .

Patch from Nick Carter <nick@chromium.org>.
2015-08-12 20:47:36 -04:00
Mark Mentovai
eb7ca8c374 Fix a few pieces of documentation
These problems were noticed while perusing
http://docs.crashpad.googlecode.com/git/doxygen/namespacecrashpad.html

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1278423002 .
2015-08-10 12:23:50 -04:00
Mark Mentovai
402bb216fb Provide a properly-typed ExpectedSizeForVersion() for types that need it
Rather than declaring ExpectedSizeForVersion() for all process_types
types and providing a default NOTREACHED() implementation, this only
declares it for process_types that request it by stating
PROCESS_TYPE_STRUCT_VERSIONED() in their proctype definition. This also
allows the argument to have the correct type, matching the type of the
struct’s version field.

TEST=crashpad_snapshot_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1274663005 .
2015-08-07 16:31:27 -04:00
Mark Mentovai
6083a2706d Recognize crashreporter_annotations_t version 5 found on OS X 10.11.
The system’s crashreporter_annotations_t structure was always present
as version 4 since Mac OS X 10.7. In OS X 10.11, it is now present as
version 5. It has also grown from 56 to 64 bytes per otool examination
of CoreFoundation’s __DATA,__crash_info section. The extra 8 bytes are
presumed to be a new field at the end of the structure, although this
is not confirmed.

The existing MachOImageAnnotationsReader.CrashAbort test only validated
that the “message” field in crashreporter_annotations_t was recovered
correctly, but
MachOImageAnnotationsReader::ReadCrashReporterClientAnnotations() also
recovers the “message2” field. A new test,
MachOImageAnnotationsReader.CrashModuleInitialization, is added to
ensure that the “messgae2” field can be recovered properly.

This change will resolve warnings such as:
[pid:tid:yyyymmdd,hhmmss.uuuuuu:WARNING
mach_o_image_annotations_reader.cc:82] unexpected crash info version 5
in
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation

BUG=crashpad:40
TEST=crashpad_snapshot_test MachOImageAnnotationsReader.CrashAbort,
     MachOImageAnnotationsReader.CrashModuleInitialization

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1277513003 .
2015-08-07 13:59:45 -04:00