bitcoin: `-fstack-protector-all` triggers crashes in mingw-w64 5.3.1

If -fstack-protector-all (part of default hardening flags) is used with the mingw-w64 compiler that is part of Ubuntu 16.04, the tests crash with:

0000000000ac1200 <boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&)>:
00000000007cdbd0 <boost::execution_monitor::execute(boost::function<int ()> const&)>:
00000000007ce1e0 <boost::execution_monitor::vexecute(boost::function<void ()> const&)>:
00000000007ba280 <boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**)>:
00000000004011b0 <__tmainCRTStartup>:
0000000000401514 <.l_start>:

This is before even reaching our code! Also bitcoin-qt crashes at startup if the wallet is enabled. This problem is reproducible both on Windows as on Wine.

The depends system was used to build the dependencies.

There is no such issue with Trusty’s compiler, as used for Travis and the current gitian builds, I don’t know if this is a compiler bug or a bug in how we use the compiler.

Bare -fstack-protectordoes not appear to trigger this issue.

Was initially discussed in #8653.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 18 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I re-tested cross-depends build with the most recent Ubuntu at this time (17.04, Zesty):

  • Had to select the ‘posix’ variant, to prevent errors about std::mutex. It looks like mingw-w64, as of 6.2.1, still has no std::mutex implementation for win32 threads.
sudo update-alternatives --config x86_64-w64-mingw32-g++
sudo update-alternatives --config x86_64-w64-mingw32-gcc
  • All depends, as well as the whole project built without errors.
  • test_bitcoin.exe runs successfully with default hardening settings, all tests pass
  • bitcoin-qt.exe runs successfully, gets synchronizing

So good news: the problem I’ve reported here is gone with newest Ubuntu. I haven’t tried any other versions, but clearly 16.04 (and possible 16.10) was a dud in this regard.

We should update build-windows.md as such, and add the part about POSIX alternatives from #8653 (but not recommend --disable-hardening!).