Skip to content
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

bitcoin-core: add workaround for libsecp256k1 related build failure #10863

Closed
wants to merge 1 commit into from

Conversation

fanquake
Copy link
Contributor

See guidovranken/cryptofuzz#55. A function was removed from libsecp256k1, causing the crypto-fuzz build to fail:

clang++ -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++ -DCRYPTOFUZZ_NO_OPENSSL -I /src/boost_1_74_0/ -DCRYPTOFUZZ_SECP256K1 -DCRYPTOFUZZ_TREZOR_FIRMWARE -DCRYPTOFUZZ_BOTAN -DCRYPTOFUZZ_BOTAN_IS_ORACLE -DCRYPTOFUZZ_BITCOIN -Wall -Wextra -std=c++17 -I include/ -I . -I fuzzing-headers/include -DFUZZING_HEADERS_NO_IMPL driver.o executor.o util.o entry.o tests.o operation.o datasource.o repository.o options.o components.o wycheproof.o crypto.o expmod.o mutator.o z3.o numbers.o mutatorpool.o ecc_diff_fuzzer_importer.o ecc_diff_fuzzer_exporter.o botan_importer.o openssl_importer.o builtin_tests_importer.o bignum_fuzzer_importer.o modules/botan/module.a modules/secp256k1/module.a modules/trezor/module.a modules/bitcoin/module.a -fsanitize=fuzzer third_party/cpu_features/build/libcpu_features.a  -o cryptofuzz
/usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x25
modules/secp256k1/module.a(secp256k1_api.o): in function `cryptofuzz_secp256k1_fe_equal_var':
secp256k1_api.c:(.text.cryptofuzz_secp256k1_fe_equal_var[cryptofuzz_secp256k1_fe_equal_var]+0x27): undefined reference to `secp256k1_fe_equal_var'
/usr/bin/ld: secp256k1_api.c:(.text.cryptofuzz_secp256k1_fe_equal_var[cryptofuzz_secp256k1_fe_equal_var]+0x39): undefined reference to `secp256k1_fe_equal_var'
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:59: cryptofuzz] Error 1
ERROR:__main__:Building fuzzers failed.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61605.

See guidovranken/cryptofuzz#55. A function was removed from libsecp256k1, causing the crypto-fuzz build to fail:
```bash
clang++ -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++ -DCRYPTOFUZZ_NO_OPENSSL -I /src/boost_1_74_0/ -DCRYPTOFUZZ_SECP256K1 -DCRYPTOFUZZ_TREZOR_FIRMWARE -DCRYPTOFUZZ_BOTAN -DCRYPTOFUZZ_BOTAN_IS_ORACLE -DCRYPTOFUZZ_BITCOIN -Wall -Wextra -std=c++17 -I include/ -I . -I fuzzing-headers/include -DFUZZING_HEADERS_NO_IMPL driver.o executor.o util.o entry.o tests.o operation.o datasource.o repository.o options.o components.o wycheproof.o crypto.o expmod.o mutator.o z3.o numbers.o mutatorpool.o ecc_diff_fuzzer_importer.o ecc_diff_fuzzer_exporter.o botan_importer.o openssl_importer.o builtin_tests_importer.o bignum_fuzzer_importer.o modules/botan/module.a modules/secp256k1/module.a modules/trezor/module.a modules/bitcoin/module.a -fsanitize=fuzzer third_party/cpu_features/build/libcpu_features.a  -o cryptofuzz
/usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x25
modules/secp256k1/module.a(secp256k1_api.o): in function `cryptofuzz_secp256k1_fe_equal_var':
secp256k1_api.c:(.text.cryptofuzz_secp256k1_fe_equal_var[cryptofuzz_secp256k1_fe_equal_var]+0x27): undefined reference to `secp256k1_fe_equal_var'
/usr/bin/ld: secp256k1_api.c:(.text.cryptofuzz_secp256k1_fe_equal_var[cryptofuzz_secp256k1_fe_equal_var]+0x39): undefined reference to `secp256k1_fe_equal_var'
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:59: cryptofuzz] Error 1
ERROR:__main__:Building fuzzers failed.
```

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61605.
@github-actions
Copy link

fanquake (verified) is either the primary contact or is in the CCs list of projects/bitcoin-core.

Copy link
Contributor

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@maflcko
Copy link
Contributor

maflcko commented Aug 21, 2023

What is the point of the change here. guidovranken/cryptofuzz#55 should be merged to fix the build issue.

If this is merged here, you'll have to create a follow-up to remove it again, which seems needless churn?

Also, CI is red here either way.

@fanquake
Copy link
Contributor Author

What is the point of the change here.

To fix the build in the interim. Given previously opened PRs in that repo have not necessarily been merged quickly.

If this is merged here, you'll have to create a follow-up to remove it again, which seems needless churn?

Sure, however the patch will just fail to apply and the build will continue to work, meaning it wont be broken again.

Also, CI is red here either way.

That is unrelated.

@maflcko
Copy link
Contributor

maflcko commented Aug 21, 2023

Yeah, no objection, but maybe wait a day or three to at least give the chance to merge the other pull? OSS-Fuzz will only build roughly once a day, and there shouldn't be any issues if a build is failing for a week or less.

@fanquake fanquake marked this pull request as draft August 21, 2023 10:50
@fanquake
Copy link
Contributor Author

The fix has been merged upstream, so we should be able to leave this as is, and the build will fix itself.

@fanquake fanquake closed this Aug 23, 2023
@fanquake fanquake deleted the fix_cryptofuzz_link_failure branch August 24, 2023 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants