Thread-safety in log_backtrace()

On legacy/trac#9299 (moved), cypherpunks reports:

log_backtrace() is thread unsafe. If threads going to assert for the same time then calling of backtrace() from every thread going to fill the same cb_buf array.

Our options here are:

  • Add a lock.
  • Make the cb_buf field non-static, and hope that the stack won't mind.

The first option looks better, I think