Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
We have been using Bitcoin Core natively in the Nunchuk Bitcoin wallet, available on both desktop and mobile. On Samsung Galaxy S25 and OnePlus 13 (both running Android 15 with the SM8750-AB Snapdragon 8 Elite 3nm processor), the app fails to initialize due to an issue in GetRandBytes()
.
The problem occurs when GetRandBytes()
calls GetRNDRRS()
, resulting in an infinite loop without retrieving entropy from the hardware.
0uint64_t GetRNDRRS() noexcept
1{
2 uint8_t ok;
3 uint64_t r1;
4 do {
5 // https://developer.arm.com/documentation/ddi0601/2022-12/AArch64-Registers/RNDRRS--Reseeded-Random-Number
6 __asm__ volatile("mrs %0, s3_3_c2_c4_1; cset %w1, ne;"
7 : "=r"(r1), "=r"(ok)::"cc");
8 if (ok) break;
9 __asm__ volatile("yield");
10 } while (true);
11 return r1;
12}
Build with: Android NDK 25.1.8937393 & 27.2.12479018
Related PR: #26839
Tested on commit: 57b47c47ef0bd36e1c32d709c62998c51dc76f34
Expected behaviour
GetRandBytes()
should return entropy without hanging.
Steps to reproduce
- Build Bitcoin Core for Android on master or 57b47c47ef0bd36e1c32d709c62998c51dc76f34
- Call
GetRandBytes
- Function gets stuck
Relevant log output
No response
How did you obtain Bitcoin Core
Compiled from source
What version of Bitcoin Core are you using?
master@57b47c47ef0bd36e1c32d709c62998c51dc76f34
Operating system and version
Android 15
Machine specifications
No response