New issue
Advanced search Search tips

Issue 884545 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Nov 19
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 1
Type: Bug

Blocked on:
issue 894363

Blocking:
issue 884849
issue 883538



Sign in to add a comment

libFuzzer on Windows cannot build with /OPT:REF

Project Member Reported by metzman@chromium.org, Sep 16

Issue description

The /OPT:REF linker flag is used by default for Chromium static builds on Windows. Its purpose is to strip unreferenced functions/data. 

Unfortunately, it doesn't seem to know about constructors, including sancov's which it strips. This breaks libFuzzer. 

Disabling this linker option allows almost any libFuzzer target to work on Windows. This is a bad solution because it means libFuzzer on Windows will be more fragile (ie: for users other than Chrome). 

It also seems to blow up the binary size.
 
Blocking: 883538
Labels: -Pri-3 OS-Windows Pri-1
Status: Started (was: Untriaged)
Project Member

Comment 3 by bugdroid1@chromium.org, Sep 28

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

commit 6376140dbb0002970d3e86b26635721bb2a8e0a7
Author: Jonathan Metzman <metzman@chromium.org>
Date: Fri Sep 28 00:16:14 2018

[libFuzzer][Windows]Temporarily disable /OPT:REF in fuzzer builds

/OPT:REF is currently stripping the constructors needed by sancov
clients (such as libFuzzer). Disable it for fuzzing builds until
this issue is resolved on the Clang/libFuzzer side.

Bug:  884545 
Change-Id: I9c12295020e6a2efc2ade268b25a555975e71c85
Reviewed-on: https://chromium-review.googlesource.com/1249151
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594927}
[modify] https://crrev.com/6376140dbb0002970d3e86b26635721bb2a8e0a7/build/config/win/BUILD.gn

Project Member

Comment 4 by bugdroid1@chromium.org, Sep 28

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

commit 484d6c6d0fd6b7abc880d8c1983c7fa601c0e50a
Author: Jonathan Metzman <metzman@chromium.org>
Date: Fri Sep 28 17:22:14 2018

[libfuzzer][Windows]Remove redundant check for use_libfuzzer

Remove redundant check for "use_libfuzzer" introduced in 6376140.
This check is redundant and causes build failures because it stops
/OPT:NOLLDTAILMERGE from being used.

Bug:  884545 
Change-Id: Ifb665751ff568ff557c4a896aca2d3b3f7a97dd3
Reviewed-on: https://chromium-review.googlesource.com/1249734
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595131}
[modify] https://crrev.com/484d6c6d0fd6b7abc880d8c1983c7fa601c0e50a/build/config/win/BUILD.gn

Blocking: 884849
What's the status here?
Nico:
I'm working on a fix here: https://reviews.llvm.org/D52119
I haven't made progress in a while because of CPPCon and then me being OOO the following week, and I had other work for libFuzzer on Windows to do in Chromium and ClusterFuzz.
I'll try to land the fix this week or early next week. Once the fix is rolled into chromium, I can get rid of my temporary disabling of /OPT:REF.
Blockedon: 894363
https://reviews.llvm.org/D52119 landed and was rolled into chrome clang.
/OPT:REF can be reenabled.
Project Member

Comment 10 by bugdroid1@chromium.org, Nov 16

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

commit f14f15d3b41e345e8b9b56fa42ca000edc6dce78
Author: Jonathan Metzman <metzman@chromium.org>
Date: Fri Nov 16 19:50:18 2018

[libFuzzer][Windows] Renable /OPT:REF builds

/OPT:REF works again with libFuzzer on Windows thanks to a clang patch
and the recent roll.
Reenable it on libFuzzer on Windows builds.

Bug:  884545 
Change-Id: Ia90acb6d1655d001c63d4fdc25700541f5ba4515
Reviewed-on: https://chromium-review.googlesource.com/c/1334556
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608902}
[modify] https://crrev.com/f14f15d3b41e345e8b9b56fa42ca000edc6dce78/build/config/win/BUILD.gn

Status: Verified (was: Started)
libFuzzer on Windows can now build with /OPT:REF and currently does in Chromium.
This seems to have really reduced the size of Windows builds.

Compare this build from before the change:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Libfuzzer%20Upload%20Windows%20ASan/1458
unpacked size: ~86

to this one after the change:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Libfuzzer%20Upload%20Windows%20ASan/1475
unpacked size: ~36

A reduction by over half!
Nice!

Sign in to add a comment