oss-fuzz
oss-fuzz copied to clipboard
bitcoin-core: Enable libc++ "Debug" hardening mode
This PR enables libc++ "Debug" hardening mode.
See https://github.com/google/oss-fuzz/pull/11725#issuecomment-2084937398.
hebasto is a new contributor to projects/bitcoin-core. The PR must be approved by known contributors before it can be merged. The past contributors are: fanquake, guidovranken, dergoegge, maflcko, achow101
cc @maflcko @fanquake
Seems fine, looking at the CI output.
Previously: https://github.com/google/oss-fuzz/actions/runs/7656996295/job/20866632302#step:7:9774 This pull: https://github.com/google/oss-fuzz/actions/runs/8411616467/job/23084431048#step:7:9734
@fanquake Any objections?
Seems fine as long as we still have LTO. Although not sure if the flags will make any difference here? given builds are with libc++, and the LLVM debug mode wont work as-is as far as I'm aware (It's also the legacy mode).
Right, D_LIBCPP_ENABLE_DEBUG_MODE should be a no-op in libc++-14-trunk. Though, I am working on bumping it to 18-trunk in oss-fuzz, so it will hopefully take effect then.
I think it is fine, but let's wait for clang-18-trunk, so that it can be tested :)
I think it is fine, but let's wait for clang-18-trunk, so that it can be tested :)
If Clang is bumped to 18 then https://github.com/bitcoin/bitcoin/pull/29781 will also be needed, as the current macro will still be a no-op.
Cross-ref to https://github.com/google/oss-fuzz/pull/10166/files
Thanks @hebasto and @maflcko, I will convert this to a draft for now until it is verified : )
This should be good to go now. Please merge or rebase with master.
This should be good to go now. Please merge or rebase with master.
Rebased.
The added comment says we aren't using CPPFLAGS, but then a few lines down we do use it.
Given we established the other flags mentioned in your PR description don't actually matter (could also be re-written now that it's outdated), why not just put -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG into CPPFLAGS, and leave everything else untouched?
The added comment says we aren't using CPPFLAGS, but then a few lines down we do use it.
Given we established the other flags mentioned in your PR description don't actually matter (could also be re-written now that it's outdated), why not just put
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUGinto CPPFLAGS, and leave everything else untouched?
Thanks! Reworked.
@DavidKorczynski this is ready for merge
cc @DavidKorczynski . Anything left to do here for this project patch?
Apologies for the delay! Will land this once the CI is green!