8000 build: pass sanitize flags to instrument libsecp256k1 code by fanquake · Pull Request #27991 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

build: pass sanitize flags to instrument libsecp256k1 code #27991

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

Closed
wants to merge 1 commit into from

Conversation

fanquake
Copy link
Member

secp256k1 functions are now instrumented:

# objdump --disassemble-symbols=_secp256k1_xonly_pubkey_serialize src/test/fuzz/fuzz | grep sanitizer_cov
100eb5244: 73 5d 01 94 	bl	0x100f0c810 <___sanitizer_cov_trace_const_cmp8>
100eb53f0: cc 5c 01 94 	bl	0x100f0c720 <___sanitizer_cov_trace_pc_indir>
100eb5418: c2 5c 01 94 	bl	0x100f0c720 <___sanitizer_cov_trace_pc_indir>
100eb5444: b7 5c 01 94 	bl	0x100f0c720 <___sanitizer_cov_trace_pc_indir>

Not sure if this is the best solution. Would fix #27990.

secp256k1 functions are now instrumented:
```asm
objdump --disassemble-symbols=_secp256k1_xonly_pubkey_serialize src/test/fuzz/fuzz | grep sanitizer_cov
100eb5244: 73 5d 01 94 	bl	0x100f0c810 <___sanitizer_cov_trace_const_cmp8>
100eb53f0: cc 5c 01 94 	bl	0x100f0c720 <___sanitizer_cov_trace_pc_indir>
100eb5418: c2 5c 01 94 	bl	0x100f0c720 <___sanitizer_cov_trace_pc_indir>
100eb5444: b7 5c 01 94 	bl	0x100f0c720 <___sanitizer_cov_trace_pc_indir>
```
@fanquake fanquake requested a review from dergoegge June 28, 2023 13:48
@DrahtBot
Copy link
Contributor
DrahtBot commented Jun 28, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK dergoegge

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28241 (Silent payment index (for light wallets and consistency check) by Sjors)
  • #28202 (Silent Payments: receiving by josibake)
  • #28201 (Silent Payments: sending by josibake)
  • #28122 (Silent Payments: Implement BIP352 by josibake)
  • #27827 (Silent Payments: send and receive by josibake)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto
Copy link
Member
hebasto commented Jun 28, 2023

Is it guaranteed that sanitizer flags for a C++ compiler are acceptible by a C compiler?

@dergoegge
Copy link
Member
dergoegge commented Jun 28, 2023

Concept ACK

All of the CI tasks that make use of the integer sanitizer are probably gonna fail.

@@ -1956,7 +1957,11 @@ CPPFLAGS_TEMP="$CPPFLAGS"
unset CPPFLAGS
CPPFLAGS="$CPPFLAGS_TEMP"

if test "$use_sanitizers" != ""; then
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --disable-module-ecdh CFLAGS=${SANITIZER_CFLAGS}"
Copy link
Member

Choose a reason for hiding this comment

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

Won't this lose the other CFLAGS currently passed by the user?

@maflcko
Copy link
Member
maflcko commented Jul 22, 2023

Maybe mark as draft for as long as CI is red?

@hebasto
Copy link
Member
hebasto commented Jul 23, 2023

FWIW, CMake works out of the box :)

@emc99
Copy link
emc99 commented Jul 23, 2023

Maybe mark as draft for as long as CI is red?

When does CI happen? Why would CI be red in this case?

@fanquake fanquake marked this pull request as draft July 25, 2023 10:48
fanquake added a commit to bitcoin-core/gui that referenced this pull request Aug 1, 2023
…pressions for `src/secp256k1` subtree

a747774 Add UBSan `-fsanitize=integer` suppressions for `src/secp256k1` subtree (Hennadii Stepanov)

Pull request description:

  Required for bitcoin/bitcoin#27991 (see the [comment](bitcoin/bitcoin#27991 (comment))) and for the upcoming CMake-based build system.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK a747774

Tree-SHA512: 602fa3ad22d3b0f6981a51358677d2347c92c4c9f59626b497af10f7ba828ede37227d8ee717f089bf33bde5efe0854d53acc89bea46f0955e62b7f22c454d05
@fanquake
Copy link
Member Author
fanquake commented Sep 7, 2023

Maybe we can followup with this in future (regardless of anything CMake related).

@fanquake fanquake closed this Sep 7, 2023
@fanquake fanquake deleted the instrument_libsecp branch September 11, 2023 09:38
fanquake added a commit that referenced this pull request Jan 26, 2024
… code

cbea49c build: Pass sanitize flags to instrument `libsecp256k1` code (Hennadii Stepanov)

Pull request description:

  This PR is a revived #27991 with an addressed [comment](#27991 (comment)).

  Fixes #27990.

  Might be tested as follows:
  ```
  $ ./autogen.sh && ./configure --enable-fuzz --with-sanitizers=fuzzer CC=clang-13 CXX=clang++-13
  $ make clean > /dev/null && make
  $ objdump --disassemble=secp256k1_xonly_pubkey_serialize src/test/fuzz/fuzz | grep __sanitizer_cov
   1953bd0:e8 bb c6 05 ff       call   9b0290 <__sanitizer_cov_trace_const_cmp8>
   1953d32:e8 69 c4 05 ff       call   9b01a0 <__sanitizer_cov_trace_pc_indir>
   1953d58:e8 43 c4 05 ff       call   9b01a0 <__sanitizer_cov_trace_pc_indir>
   1953d82:e8 19 c4 05 ff       call   9b01a0 <__sanitizer_cov_trace_pc_indir>
  ```

ACKs for top commit:
  fanquake:
    ACK cbea49c
  dergoegge:
    reACK cbea49c

Tree-SHA512: 801994e75b711d20eaf0d675f378da07d693f4a7de026efd93860f5f1deabed855a83eca3561725263e4fe605fcc5f91eb73c021ec91c831864e6deb575e3885
@bitcoin bitcoin locked and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libsecp256k1 not instrumented when building with sanitizers
7 participants
0