Skip to content

lms: fix crash on startup due to boost::asio ABI mismatch - #62009

Open
Danoloan10 wants to merge 1 commit into
void-linux:masterfrom
Danoloan10:lms-fix-asio-abi-crash
Open

lms: fix crash on startup due to boost::asio ABI mismatch#62009
Danoloan10 wants to merge 1 commit into
void-linux:masterfrom
Danoloan10:lms-fix-asio-abi-crash

Conversation

@Danoloan10

Copy link
Copy Markdown
Contributor

lms would crash in x86_64-musl after updating every package to their latest versions.

lms and libwthttp (from wt) each compile their own copy of the header-only boost::asio, but share one epoll_reactor at runtime via asio's service registry. Their reactor layouts must therefore match.

asio's reactor layout depends on BOOST_ASIO_HAS_STD_ATOMIC_WAIT (C++20 std::atomic::wait): lms is C++20, so asio uses atomic_slim_mutex (152-byte reactor, free_list_ at +0x90); wt is C++14, so libwthttp uses posix_mutex (232-byte reactor, free_list_ at +0xe0).

The mismatch makes libwthttp read registered_descriptors_ past lms's allocation and SIGSEGV in object_pool::alloc during Server::start (addTcpListener) on every startup.

Force the posix_mutex path with BOOST_ASIO_DISABLE_STD_ATOMIC_WAIT so lms's reactor ABI matches libwthttp. Verified on x86_64-musl: lms now starts and serves on :5082 without crashing.

Testing the changes

  • I tested the changes in this PR: YES

Local build testing

  • I built this PR locally for my native architecture, (x86_64-musl)

lms and libwthttp (from wt) each compile their own copy of the header-only
boost::asio, but share one epoll_reactor at runtime via asio's service
registry.  Their reactor layouts must therefore match.

asio's reactor layout depends on BOOST_ASIO_HAS_STD_ATOMIC_WAIT (C++20
std::atomic::wait): lms is C++20, so asio uses atomic_slim_mutex (152-byte
reactor, free_list_ at +0x90); wt is C++14, so libwthttp uses posix_mutex
(232-byte reactor, free_list_ at +0xe0).

The mismatch makes libwthttp read registered_descriptors_ past lms's
allocation and SIGSEGV in object_pool::alloc during Server::start
(addTcpListener) on every startup.

Force the posix_mutex path with BOOST_ASIO_DISABLE_STD_ATOMIC_WAIT so lms's
reactor ABI matches libwthttp.  Verified on x86_64-musl: lms now starts and
serves on :5082 without crashing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant