Bitcoin-ABC / Bitcoin-ABC/bitcoin-abc

build with address sanitizer will always crash

Open
#260 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
C++
Stars
1.3k
Forks
788
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue
Bitcoin ABC crash with "--enable-asan".

### Can you reliably reproduce the issue?
Yes

#### If so, please list the steps to reproduce below:
1. ./configure --disable-wallet --without-miniupnpc --without-gui --disable-bench --disable-tests --enable-debug --enable-asan
2. make
3. run

### Expected behaviour
Address sanitizer should not detect error

### Actual behaviour
Address sanitizer detect error
```
ASAN:SIGSEGV
=================================================================
==26938==ERROR: AddressSanitizer: SEGV on unknown address 0x00006a09e5e7 (pc 0x5596f2c5a573 bp 0x7ffd6b5d7bc0 sp 0x7ffd6b5d7a50 T0)
#0 0x5596f2c5a572 in sha256_sse4::Transform(unsigned int*, unsigned char const*, unsigned long) crypto/sha256_sse4.cpp:953
#1 0x5596f2c5562f in SelfTest crypto/sha256.cpp:246
#2 0x5596f2c5586c in SHA256AutoDetect[abi:cxx11]() crypto/sha256.cpp:264
#3 0x5596f25cabfa in AppInitSanityChecks() /home/gani/Projects/core/bitcoin-abc/src/init.cpp:1715
#4 0x5596f2587fb5 in AppInit(int, char**) /home/gani/Projects/core/bitcoin-abc/src/bitcoind.cpp:156
#5 0x5596f2588ac9 in main /home/gani/Projects/core/bitcoin-abc/src/bitcoind.cpp:208
#6 0x7f871f04eb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#7 0x5596f2586f79 in _start (/home/gani/Projects/core/bitcoin-abc/src/bitcoind+0x177f79)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV crypto/sha256_sse4.cpp:953 sha256_sse4::Transform(unsigned int*, unsigned char const*, unsigned long)
==26938==ABORTING

### What version of bitcoin-abc are you using?
Latest build, but few last releases have the same problem

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the provided ./configure and make commands, then start at crypto/sha256_sse4.cpp:953 and trace the SelfTest and SHA256AutoDetect calls in crypto/sha256.cpp. Compare the ASAN failure with the initialization path through AppInitSanityChecks in src/init.cpp. Done means the configured build starts without the reported ASAN crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.