New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 636157 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

SafeBrowsingEnvironmentDataCollectionWinTest.VerifyLoadedModules failing on WinASan bot (again)

Project Member Reported by r...@chromium.org, Aug 9 2016

Issue description

This test is failing because clang is able to optimize DummyExport down to just "RET", which is folded by ICF with all other functions that just return. It just so happens that one of those functions is registered as an at-exit time destructor. The VerifyLoadedModules test uses WriteProcessMemory to increment the first byte of DummyExport. However, because of comdat folding, this modifies all the other no-op functions that were folded with DummyExport. The at-exit destructor is called during module unload time, and it crashes, causing the test to fail.

The solution is simple: volatilize the global variable store to defeat clang's dead store deletion and the follow-on ICF by the linker.

P.S. This was very "fun" to debug.
 

Comment 1 by r...@chromium.org, Aug 9 2016

I think it only reproduces with ASan because ASan either includes or brings in some CRT code that registers a no-op destructor.
Project Member

Comment 2 by bugdroid1@chromium.org, Aug 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/98b87cf47c62669a1bcd67f0db868c31482605a1

commit 98b87cf47c62669a1bcd67f0db868c31482605a1
Author: rnk <rnk@chromium.org>
Date: Wed Aug 10 20:25:07 2016

Volatilize the global store in DummyExport to defeat Clang's optimizer and avoid ICF

Otherwise this test crashes under ASan while running a corrupted at-exit handler.

R=grt@chromium.org,thakis@chromium.org
BUG= 636157 

Review-Url: https://codereview.chromium.org/2228233002
Cr-Commit-Position: refs/heads/master@{#411134}

[modify] https://crrev.com/98b87cf47c62669a1bcd67f0db868c31482605a1/chrome/browser/safe_browsing/incident_reporting/verifier_test/verifier_test_dll.cc

Comment 3 by r...@chromium.org, Sep 13 2016

Status: Fixed (was: Untriaged)

Sign in to add a comment