| Index: chrome/installer/setup/setup_main.cc
|
| diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
|
| index b8d66b6b4d596eb278d0ee5245f344064b7ba2fe..6b80ef657f7451089ed5704e9540adc4c67e85c8 100644
|
| --- a/chrome/installer/setup/setup_main.cc
|
| +++ b/chrome/installer/setup/setup_main.cc
|
| @@ -82,6 +82,10 @@
|
| #include "components/crash/content/app/run_as_crashpad_handler_win.h"
|
| #include "content/public/common/content_switches.h"
|
|
|
| +#if defined(SYZYASAN)
|
| +#include "base/debug/asan_invalid_access.h"
|
| +#endif
|
| +
|
| using installer::InstallerState;
|
| using installer::InstallationState;
|
| using installer::MasterPreferences;
|
| @@ -1042,6 +1046,21 @@ bool HandleNonInstallCmdLineOptions(const base::FilePath& setup_exe,
|
| cmd_line.GetSwitchValueNative(
|
| installer::switches::kSetDisplayVersionValue));
|
| *exit_code = OverwriteDisplayVersions(registry_product, registry_value);
|
| +#if defined(SYZYASAN)
|
| + } else if (cmd_line.HasSwitch(installer::switches::kInduceAsanCrash)) {
|
| + std::string crash_type =
|
| + cmd_line.GetSwitchValueASCII(installer::switches::kInduceAsanCrash);
|
| + if (crash_type == installer::switches::kAsanUseAfterFree) {
|
| + base::debug::AsanHeapUseAfterFree();
|
| + } else if (crash_type == installer::switches::kAsanHeapOverflow) {
|
| + base::debug::AsanHeapOverflow();
|
| + } else if (crash_type == installer::switches::kAsanHeapUnderflow) {
|
| + base::debug::AsanHeapUnderflow();
|
| + } else {
|
| + LOG(ERROR) << "Invalid Asan error type: " << crash_type;
|
| + handled = false;
|
| + }
|
| +#endif
|
| } else {
|
| handled = false;
|
| }
|
| @@ -1049,6 +1068,24 @@ bool HandleNonInstallCmdLineOptions(const base::FilePath& setup_exe,
|
| return handled;
|
| }
|
|
|
| +#if defined(SYZYASAN)
|
| +// Initialize the SyzyAsan crash reporter. This should only be called once the
|
| +// crash reporter has been initialized. There should be only one call to this
|
| +// function.
|
| +void SetupSyzyAsan() {
|
| + using SyzyAsanInitializeCrashReporterFn = VOID(WINAPI*)();
|
| + HMODULE syzyasan_handle = ::GetModuleHandle(L"syzyasan_rtl.dll");
|
| + if (!syzyasan_handle)
|
| + return;
|
| +
|
| + SyzyAsanInitializeCrashReporterFn syzyasan_init_crash_reporter =
|
| + reinterpret_cast<SyzyAsanInitializeCrashReporterFn>(
|
| + ::GetProcAddress(syzyasan_handle, "asan_InitializeCrashReporter"));
|
| + if (syzyasan_init_crash_reporter)
|
| + syzyasan_init_crash_reporter();
|
| +}
|
| +#endif
|
| +
|
| } // namespace
|
|
|
| namespace installer {
|
| @@ -1364,6 +1401,10 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
|
| installer::SetInitialCrashKeys(installer_state);
|
| installer::SetCrashKeysFromCommandLine(cmd_line);
|
|
|
| +#if defined(SYZYASAN)
|
| + SetupSyzyAsan();
|
| +#endif
|
| +
|
| // Make sure the process exits cleanly on unexpected errors.
|
| base::EnableTerminationOnHeapCorruption();
|
| base::EnableTerminationOnOutOfMemory();
|
|
|