diff --git a/DEPS b/DEPS index 857d3a9d..0eeedd45 100644 --- a/DEPS +++ b/DEPS @@ -47,7 +47,7 @@ deps = { '9719c1e1e676814c456b55f5f070eabad6709d31', 'crashpad/third_party/mini_chromium/mini_chromium': Var('chromium_git') + '/chromium/mini_chromium@' + - '12ef786772d9a73751e2d0f3ef9c792b09c386b5', + '08d490553b0dcb1324efb59b13be839d7f9f3b62', 'crashpad/third_party/libfuzzer/src': Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' + 'fda403cf93ecb8792cb1d061564d89a6553ca020', @@ -126,15 +126,18 @@ deps = { 'condition': 'checkout_fuchsia and host_os == "linux"', 'dep_type': 'cipd' }, - 'crashpad/third_party/windows/clang/windows-amd64': { - 'packages': [ + 'crashpad/third_party/windows/clang/win-amd64': { + 'bucket': 'chromium-browser-clang', + 'objects': [ { - 'package': 'fuchsia/third_party/clang/windows-amd64', - 'version': 'XiBHLTa8HHj9lYwC-ArymS75s792s0_ANNvLOfsILqMC', + 'object_name': 'Win/clang-llvmorg-20-init-17108-g29ed6000-2.tar.xz', + 'sha256sum': '1c71efd923a91480480d4f31c2fd5f1369e01e14f15776a9454abbce0bc13548', + 'size_bytes': 46357580, + 'generation': 1737590897363452, }, ], 'condition': 'checkout_win and host_os == "win"', - 'dep_type': 'cipd' + 'dep_type': 'gcs', }, 'crashpad/third_party/fuchsia-gn-sdk': { 'packages': [ diff --git a/handler/win/crashy_test_program.cc b/handler/win/crashy_test_program.cc index 0929f337..a1449798 100644 --- a/handler/win/crashy_test_program.cc +++ b/handler/win/crashy_test_program.cc @@ -133,7 +133,7 @@ bool CreateThreadWithRegisterPointingToTestMemory() { return true; } -void SomeCrashyFunction() { +__declspec(noinline) void SomeCrashyFunction() { // SetLastError and NTSTATUS so that we have something to view in !gle in // windbg. RtlNtStatusToDosError() stores STATUS_NO_SUCH_FILE into the // LastStatusError of the TEB as a side-effect, and we'll be setting diff --git a/handler/win/self_destroying_test_program.cc b/handler/win/self_destroying_test_program.cc index fbcc3510..1e98a2f7 100644 --- a/handler/win/self_destroying_test_program.cc +++ b/handler/win/self_destroying_test_program.cc @@ -24,11 +24,17 @@ namespace crashpad { namespace { +// Without this, clang optimizes away the _alloca below, which in turn +// makes the VirtualFree() crash with an access violation. +#if defined(__clang__) +#pragma clang optimize off +#endif + // We VirtualFree a region in ourselves (the stack) to confirm that the // exception reporter captures as much as possible in the minidump and doesn't // abort. __debugbreak() immediately after doing so because the process is // clearly in a very broken state at this point. -bool FreeOwnStackAndBreak() { +__declspec(noinline) bool FreeOwnStackAndBreak() { ProcessReaderWin process_reader; if (!process_reader.Initialize(GetCurrentProcess(), ProcessSuspensionState::kRunning)) { @@ -45,7 +51,7 @@ bool FreeOwnStackAndBreak() { // Push the stack up a bit so that hopefully the crash handler can succeed, // but won't be able to read the base of the stack. - _alloca(16384); + [[maybe_unused]] volatile void* do_not_optimize_away = _alloca(16384); // We can't succeed at MEM_RELEASEing this memory, but MEM_DECOMMIT is good // enough to make it inaccessible. @@ -63,7 +69,7 @@ bool FreeOwnStackAndBreak() { return true; } -int SelfDestroyingMain(int argc, wchar_t* argv[]) { +__declspec(noinline) int SelfDestroyingMain(int argc, wchar_t* argv[]) { if (argc != 2) { fprintf(stderr, "Usage: %ls \n", argv[0]); return EXIT_FAILURE; @@ -83,6 +89,10 @@ int SelfDestroyingMain(int argc, wchar_t* argv[]) { return EXIT_SUCCESS; } +#if defined(__clang__) +#pragma clang optimize on +#endif + } // namespace } // namespace crashpad