From c6096c3c340b39171a6fcfebd19fd21e2b8da7c1 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 23 Sep 2019 23:12:40 +0200 Subject: [PATCH 1/2] Workaround for a bug in binutils-2.32-1 on ARM ldr/madd instruction sequence makes compiled binary crash, so separate them. --- src/crypto/randomx/jit_compiler_a64_static.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crypto/randomx/jit_compiler_a64_static.S b/src/crypto/randomx/jit_compiler_a64_static.S index a813e821..be37602b 100644 --- a/src/crypto/randomx/jit_compiler_a64_static.S +++ b/src/crypto/randomx/jit_compiler_a64_static.S @@ -485,12 +485,13 @@ randomx_calc_dataset_item_aarch64: stp x10, x11, [sp, 80] stp x12, x13, [sp, 96] + ldr x12, superscalarMul0 + mov x8, x0 mov x9, x1 mov x10, x2 # rl[0] = (itemNumber + 1) * superscalarMul0; - ldr x12, superscalarMul0 madd x0, x2, x12, x12 # rl[1] = rl[0] ^ superscalarAdd1; From 1bba25e08065e335f0e59e799152927807594916 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Tue, 24 Sep 2019 08:53:00 +0200 Subject: [PATCH 2/2] Set scratchpad pointer to null by default To avoid freeing random blocks of memory in some cases. --- src/crypto/randomx/virtual_machine.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/randomx/virtual_machine.hpp b/src/crypto/randomx/virtual_machine.hpp index 2dc89bb5..c85af009 100644 --- a/src/crypto/randomx/virtual_machine.hpp +++ b/src/crypto/randomx/virtual_machine.hpp @@ -64,7 +64,7 @@ protected: alignas(64) randomx::RegisterFile reg; alignas(16) randomx::ProgramConfiguration config; randomx::MemoryRegisters mem; - uint8_t* scratchpad; + uint8_t* scratchpad = nullptr; union { randomx_cache* cachePtr = nullptr; randomx_dataset* datasetPtr;