Skip to content

Commit

Permalink
Reland of Don't IAT patch SetUnhandledExceptionFilter when ASan is ac…
Browse files Browse the repository at this point in the history
…tive (patchset chromium#1 id:1 of https://codereview.chromium.org/2225453002/ )

Reason for revert:
This patch didn't impact Crashpad.

Original issue's description:
> Revert of Don't IAT patch SetUnhandledExceptionFilter when ASan is active (patchset chromium#1 id:1 of https://codereview.chromium.org/2220583002/ )
>
> Reason for revert:
> This causes crashpad to emit "haven't called UseHandler()" errors later.
>
> Original issue's description:
> > Don't IAT patch SetUnhandledExceptionFilter when ASan is active
> >
> > ASan installs its own exception filter that ClusterFuzz needs to see.
> >
> > R=robertshield@chromium.org,inferno@chromium.org
> > BUG=626373
> >
> > Committed: https://crrev.com/3894e46c8c2702e12d2ddec12f186d7c1cf5c412
> > Cr-Commit-Position: refs/heads/master@{#410077}
>
> TBR=inferno@chromium.org,robertshield@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=626373
>
> Committed: https://crrev.com/07928da2532a9a7d1149d0878d0931dd209f0d3c
> Cr-Commit-Position: refs/heads/master@{#410106}

TBR=robertshield@chromium.org,scottmg@chromium.org,rsesek@chromium.org,aarya@google.com,rnk@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=626373

Review-Url: https://codereview.chromium.org/2217833004
Cr-Commit-Position: refs/heads/master@{#410232}
  • Loading branch information
inferno-chromium authored and Commit bot committed Aug 6, 2016
1 parent b9ec37c commit 009fe04
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion chrome_elf/chrome_elf_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void InitializeCrashReportingForProcess() {
ChromeCrashReporterClient::InitializeCrashReportingForProcess();
}

#if !defined(ADDRESS_SANITIZER)
// chrome_elf loads early in the process and initializes Crashpad. That in turn
// uses the SetUnhandledExceptionFilter API to set a top level exception
// handler for the process. When the process eventually initializes, CRT sets
Expand Down Expand Up @@ -80,6 +81,7 @@ void DisableSetUnhandledExceptionFilter() {
SetUnhandledExceptionFilterPatch);
CHECK(patched == 0);
}
#endif // !defined(ADDRESS_SANITIZER)

} // namespace

Expand Down Expand Up @@ -112,8 +114,11 @@ BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) {
InitializeCrashReportingForProcess();
// CRT on initialization installs an exception filter which calls
// TerminateProcess. We need to hook CRT's attempt to set an exception
// handler and ignore it.
// handler and ignore it. Don't do this when ASan is present, or ASan will
// fail to install its own unhandled exception filter.
#if !defined(ADDRESS_SANITIZER)
DisableSetUnhandledExceptionFilter();
#endif

install_static::InitializeProcessType();
if (install_static::g_process_type ==
Expand Down

0 comments on commit 009fe04

Please sign in to comment.