-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
infra: fix fuzz-introspector linker flags #7583
infra: fix fuzz-introspector linker flags #7583
Conversation
Moves -fuse-ld=gold to compile flags and removes -flto from linker flags. Should fix a number of the projects google#7540 (comment) Ref: google#7540 (comment) Ref: google#7540 (comment)
I passed these flags to the systemd build script and it appears it isn't compatible with
It seems to be another variation on mesonbuild/meson#4542 |
hmm, I just tried successfully running |
The systemd build system supports three different modes of building the fuzz targets. I ran it locally without the OSS-Fuzz toolchain. On OSS-Fuzz that particular check isn't triggered because it's always assumed that |
@dcbaker @eli-schwartz I wonder what the best way to pass
and I kind of agree with that but on the other hand OSS-Fuzz has to support all kinds of build systems and CFLAGS has worked fine so far. |
This PR is going to break |
@Navidem could please take a look? This one is ready to go |
FWIW turns out |
Before I forget, it's possible to make + if [[ "$SANITIZER" == introspector ]]; then
+ # -fuse-ld=gold can't be passed via CFLAGS/CXXFLAGS/LDFLAGS due to
+ # https://github.com/mesonbuild/meson/issues/6377 and
+ # https://github.com/mesonbuild/meson/issues/6377#issuecomment-575977919
+ CFLAGS="${CFLAGS//-fuse-ld=gold/ }"
+ CXXFLAGS="${CXXFLAGS//-fuse-ld=gold/ }"
+ LDFLAGS="${LDFLAGS//-fuse-ld=gold/ }"
+ export CC_LD=gold
+ export CXX_LD=gold
+
+ # OSS-Fuzz passes -flto via CFLAGS/CXXFLAGS. Let's append it to LDFLAGS
+ # as well just in case. Another option would be to use -Db_lto* but it
+ # doesn't always mix well with CFLAGS/CXXFLAGS
+ LDFLAGS+=" -flto"
+ fi It's fragile and unmaintainble but it should do the trick. I'd wait until fuzz-introspector is more or less settled before adding this kludge to the systemd build script. @DavidKorczynski on a somewhat unrelated note I wonder if there are links to the latest fuzz-introspector reports by analogy with https://oss-fuzz.com/coverage-report/job/libfuzzer_asan_systemd/latest . I tried replacing dates with "latest" but it didn't work out. |
@evverx you can check this introspector report for systemd, if that's what you are looking for: |
@Navidem I was looking for a link that could always point to the latest fuzz-introspector report without having to specify dates. For example, currently https://oss-fuzz.com/coverage-report/job/libfuzzer_asan_systemd/latest redirects to https://storage.googleapis.com/oss-fuzz-coverage/systemd/reports/20220419/linux/report.html and tomorrow it will change accordingly. |
Thanks for showing the fix on meson @evverx -- to my knowledge there is no latest link on fuzz-introspector reports atm. |
Ah, now I see your point, currently we don't have the link to the latest reports as such for coverage. |
Right, we don't have this latest link redirection for fuzz introspector right now. In the meantine, there is a continuously generated index on https://oss-fuzz-introspector.storage.googleapis.com/index.html that links to the latest generated reports for each project. |
@oliverchang thanks! It appears those links point to incomplete reports: #7599 |
fuzz-introspector passes -fuse-ld=gold and -flto using CFLAGS/LDFLAGS and due to mesonbuild/meson#6377 (comment) and mesonbuild/meson#6377 it doesn't mix well with meson. It's possible to build systemd with duct tape there using something like google/oss-fuzz#7583 (comment) but apparently even with gold and lto some parts of systemd are missing from reports (presumably due to google/oss-fuzz#7598). Let's just fail here for now to make it clear that fuzz-introspector isn't supported.
fuzz-introspector passes -fuse-ld=gold and -flto using CFLAGS/LDFLAGS and due to mesonbuild/meson#6377 (comment) and mesonbuild/meson#6377 it doesn't mix well with meson. It's possible to build systemd with duct tape there using something like google/oss-fuzz#7583 (comment) but apparently even with gold and lto some parts of systemd are missing from reports (presumably due to google/oss-fuzz#7598). Let's just fail here for now to make it clear that fuzz-introspector isn't supported.
Moves -fuse-ld=gold to compile flags and removes -flto from linker flags. Should fix a number of the projects google#7540 (comment) Ref: google#7540 (comment) Ref: google#7540 (comment)
Workarounds the issue where compile tests would fail with `-Werror=ignored-optimization-argument` because Meson doesn't allow linker flags in `CFLAGS` or `CXXFLAGS`. See: mesonbuild/meson#6377 (comment) Thanks to @evverx for the idea: google#7583 (comment) This is a fragile workaround, but it looks like there isn't much else we can do.
Workarounds the issue where compile tests would fail with `-Werror=ignored-optimization-argument` because Meson doesn't allow linker flags in `CFLAGS` or `CXXFLAGS`. See: mesonbuild/meson#6377 (comment) Thanks to @evverx for the idea: #7583 (comment) This is a fragile workaround, but it looks like there isn't much else we can do.
Moves -fuse-ld=gold to compile flags and removes -flto from linker
flags.
Should fix a number of the projects
#7540 (comment)
Ref:
#7540 (comment)
Ref:
#7540 (comment)