New issue
Advanced search Search tips

Issue 598943 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 82385



Sign in to add a comment

package.py appears to build compiler-rt with frame frame pointer elimination

Project Member Reported by r...@chromium.org, Mar 30 2016

Issue description

This is problematic, because CaptureStackBacktrace can't unwind out of the __asan_report_* functions. Here's the code from the pre-built winasan runtime:

___asan_report_store4:
  00000000: 51                 push        ecx
  00000001: 6A 01              push        1
  00000003: 6A 00              push        0
  00000005: 6A 04              push        4
  00000007: 6A 01              push        1
  00000009: FF 74 24 18        push        dword ptr [esp+18h]
  0000000D: 8D 44 24 14        lea         eax,[esp+14h]
  00000011: 50                 push        eax
  00000012: 8B 44 24 1C        mov         eax,dword ptr [esp+1Ch]
  00000016: 68 EF BE AD DE     push        0DEADBEEFh
  0000001B: 50                 push        eax
  0000001C: E8 00 00 00 00     call        ?ReportGenericError@__asan@@YAXKKKK_NKI0@Z
  00000021: 83 C4 24           add         esp,24h
  00000024: C3                 ret

My local build has this:
___asan_report_store4:
  00000000: 55                 push        ebp
  00000001: 8B EC              mov         ebp,esp
  00000003: 51                 push        ecx
...

What gives?
 

Comment 1 by r...@chromium.org, Mar 30 2016

Cc: infe...@chromium.org

Comment 2 by r...@chromium.org, Mar 30 2016

I'm pretty sure this blocks fuzzing with WinASan.

Comment 3 by thakis@chromium.org, Mar 30 2016

Is your local build a bootstrap build? package.py does do bootstrap builds.

(Nice find!)

Comment 4 by r...@chromium.org, Mar 30 2016

My 32-bit build directory is not bootstrapped. I thought our special compiler-rt build wasn't bootstrapped, but I guess I was wrong.

Either way, there's cmake in compiler-rt that is supposed to add /Oy- to cflags, and it's not making it through.
Labels: Te-NeedsFurtherTriage

Comment 6 by h...@chromium.org, Mar 30 2016

Labels: -Te-NeedsFurtherTriage
Status: Available (was: Unconfirmed)

Comment 7 by r...@chromium.org, Mar 30 2016

Here's our final compiler-rt cmake invocation:
[u'D:\\src\\depot_tools\\win_toolchain\\vs_files\\a3796183a9fc4d22a687c5212b9c76dbd136d70d\\win_sdk\\Bin\\SetEnv.Cmd', '/x86', '&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', '-DLLVM_ENABLE_ASSERTIONS=ON', '-DLLVM_ENABLE_THREADS=OFF', '-DLLVM_ENABLE_TIMESTAMPS=OFF', '-DLLVM_USE_CRT_RELEASE=MT', '-DCMAKE_C_FLAGS=-fms-compatibility-version=19', '-DCMAKE_CXX_FLAGS=-fms-compatibility-version=19', 'D:\\src\\chromium\\src\\third_party\\llvm']

We are *not* doing a bootstrap, and we are passing -fms-compatibility-version=19. MSVC does not support that flag, and it ignores it with a warning. The problem is that this breaks cmake's check_cxx_compiler_flag, because every compilation prints this warning:

Performing C++ SOURCE FILE Test COMPILER_RT_HAS_Oy_FLAG failed with the following output:
...
Run Build Command:"C:/Users/rnk/bin/ninja.exe" "cmTryCompileExec1326809275"
[1/2] Building CXX object CMakeFiles\cmTryCompileExec1326809275.dir\src.cxx.obj
cl : Command line warning D9002 : ignoring unknown option '-fms-compatibility-version=19'
[2/2] Linking CXX executable cmTryCompileExec1326809275.exe

CMake looks for the text "ignoring unknown option" as a sign that the flag under test is not supported.

So, in conclusion, we should probably teach LLVM (and compiler-rt) to only add -fms-compatibility-version=19 if "CLANG_CL AND MSVC_VERSION EQUALS 1900". Then we can remove -fms-compatibility-version=19 from the Chromium scripts.
Project Member

Comment 8 by bugdroid1@chromium.org, Apr 1 2016

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

commit 58dbc65a7fa88580b84d9438bd8e98706b34aded
Author: rnk <rnk@chromium.org>
Date: Fri Apr 01 03:28:32 2016

Roll Clang 264334:264915

This picks up upstream CMake changes that remove the need to pass
-fms-compatibility-version=19. Removing that flag also has the side
effect of preserving frame pointers in the ASan runtime. (!)

I have successfully built and uploaded a Windows package, and will
use try jobs to attempt to build and upload Mac and Linux packages.

R=thakis@chromium.org
BUG= 598943 

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

Cr-Commit-Position: refs/heads/master@{#384475}

[modify] https://crrev.com/58dbc65a7fa88580b84d9438bd8e98706b34aded/tools/clang/scripts/update.py

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

Status: Fixed (was: Available)
Frame pointers are back:

___asan_report_store4:
  00000000: 55                 push        ebp
  00000001: 8B EC              mov         ebp,esp
  00000003: 51                 push        ecx
  00000004: 6A 01              push        1
Blocking: 82385

Sign in to add a comment