New issue
Advanced search Search tips

Issue 833951 link

Starred by 3 users

Issue metadata

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

Blocked on:
issue 834010

Blocking:
issue 792131



Sign in to add a comment

checkbins fails in lld builds in 32-bit

Project Member Reported by thakis@chromium.org, Apr 17 2018

Issue description

https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium%2FWin%2F66203%2F%2B%2Frecipes%2Fsteps%2Fcheckbins%2F0%2Fstdout

Checking C:\b\c\b\win\src\out\Release\eventlog_provider.dll for /SAFESEH... FAIL
...
Checking C:\b\c\b\win\src\out\Release\remoting_console.exe for /SAFESEH... FAIL
...
Checking C:\b\c\b\win\src\out\Release\remoting_desktop.exe for /SAFESEH... FAIL
...
Checking C:\b\c\b\win\src\out\Release\remoting_host.exe for /SAFESEH... FAIL
...
Result: 507 files found, 503 files passed



64-bit is happy.
 

Comment 1 by thakis@chromium.org, Apr 17 2018

https://cs.chromium.org/chromium/src/tools/checkbins/checkbins.py?q=checkbins&sq=package:chromium&dr&l=76 :

    # Check for /SAFESEH. Binaries should meet one of the following
    # criteria:
    #   1) Have no SEH table as indicated by the DLL characteristics
    #   2) Have a LOAD_CONFIG section containing a valid SEH table
    #   3) Be a 64-bit binary, in which case /SAFESEH isn't required
    #
    # Refer to the following MSDN article for more information:
    # http://msdn.microsoft.com/en-us/library/9a89h429.aspx
    if (pe.OPTIONAL_HEADER.DllCharacteristics & NO_SEH_FLAG or
        (hasattr(pe, "DIRECTORY_ENTRY_LOAD_CONFIG") and
         pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SEHandlerCount > 0 and
         pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SEHandlerTable != 0) or
        pe.FILE_HEADER.Machine == MACHINE_TYPE_AMD64):
      if options.verbose:
        print "Checking %s for /SAFESEH... PASS" % path
    else:
      success = False
      print "Checking %s for /SAFESEH... FAIL" % path

Comment 2 by thakis@chromium.org, Apr 17 2018

(It's a hand-rolled variant of binskim / binscope -- I wonder if we should try running those too?)

Comment 4 by thakis@chromium.org, Apr 17 2018

args.gn on that bot: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium%2FWin%2F66203%2F%2B%2Frecipes%2Fsteps%2Fgenerate_build_files%2F0%2Fstdout

goma_dir = "C:\\b\\c\\goma_client"
is_component_build = false
is_debug = false
skip_archive_compression = false
strip_absolute_paths_from_debug_symbols = true
symbol_level = 1
target_cpu = "x86"
use_goma = true

(and, on the failing build, implicitly use_lld=true)

Comment 5 by thakis@chromium.org, Apr 17 2018

…ok, I really need to do something else until Thu, sorry :-(

Comment 6 by r...@chromium.org, Apr 17 2018

Blockedon: 834010

Comment 7 by h...@chromium.org, Apr 17 2018

rnk: Does blocking on the roll mean there's a fix upstream already?

Comment 8 by tikuta@chromium.org, Apr 17 2018

Labels: -OS-Mac OS-Windows

Comment 9 by r...@chromium.org, Apr 18 2018

Owner: r...@chromium.org
Status: Assigned (was: Untriaged)
> rnk: Does blocking on the roll mean there's a fix upstream already?

No, but it's a quick fix, and I really just wanted to link the bugs together. It will be blocked on the roll soon enough that I didn't feel like marking the roll blocked on fixing this bug, and then flipping the relationship.

---

I think this is just a small variance in our safeseh implementation. I linked remoting_host.exe on Linux and ran llvm-readobj -coff-load-config -headers on it. This is the important stuff:

...
  Characteristics [ (0xC140)
    IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
    IMAGE_DLL_CHARACTERISTICS_GUARD_CF (0x4000)
    IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
    IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
  ]
...
LoadConfig [
...
  SecurityCookie: 0x404000
  SEHandlerTable: 0x0
  SEHandlerCount: 0
...

I think to match checkbin's expectations, we need to set IMAGE_DLL_CHARACTERISTICS_NO_SEH when there are zero exception handlers in the binary. We currently only set the flag when there is no load config present, i.e. the user is building a DLL that doesn't link against the MSVC CRT, which is common for mingw users. We should probably just make it conditional on the presence of exception handlers.

Comment 10 by r...@chromium.org, Apr 18 2018

r330300 should fix this.

Comment 11 by h...@chromium.org, Apr 26 2018

Status: Fixed (was: Assigned)

Sign in to add a comment