Veil-Project / veil

Veil-Project
MIT License
118 stars 91 forks source link

Avoid non-trivial global constants in SHA-NI code #956

Closed Zannick closed 3 years ago

Zannick commented 3 years ago

This is a cherry-pick of https://github.com/bitcoin/bitcoin/pull/18553 fixing https://github.com/bitcoin/bitcoin/issues/18456 which suddenly cropped up on my linux 18.04 machine.

Problem

Certain linux configurations may encounter a SIGILL Illegal Instruction that causes a locally-built veild to crash immediately. Using gdb to catch the stack trace will give a reference to global variable initialization in the sha256_shani.cpp file. Root cause appears to be a global constant is not produced correctly by the compiler as a constant.

Solution

Cherry-pick bitcoin's solution to the same problem.

Testing

Verified that veild (regtest) is now able to run on the machine where this issue occurred.