]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cmake/boost: build libboost_context with BOOST_USE_ASAN 69660/head
authorKefu Chai <k.chai@proxmox.com>
Tue, 23 Jun 2026 07:46:05 +0000 (15:46 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 23 Jun 2026 22:44:18 +0000 (06:44 +0800)
commita1afaa6529ce6e4a980a9634c8c8c4ceb201cb42
treefc1a6947fae811229d75bce623254c291ae94555
parentb4f29b38dfdd3ee2d83c44aa6ced47f704030d2f
cmake/boost: build libboost_context with BOOST_USE_ASAN

The ceph-api job failed under ASan: radosgw-admin aborted at startup with a
heap-buffer-overflow in boost.context's fiber resume().

  ==1155842==ERROR: AddressSanitizer: heap-buffer-overflow ... READ of size 8
    #0 boost::context::detail::fiber_activation_record::resume() fiber_ucontext.hpp:153
    #10 RGWSI_Notify::do_start(optional_yield, DoutPrefixProvider const*) svc_notify.cc:261
  0x... is located 8 bytes after 1048-byte region allocated by
    boost::context::detail::fiber_activation_record_initializer()

fiber_activation_record carries three extra members (fake_stack, stack_bottom,
stack_size) only when BOOST_USE_ASAN is defined.  Under WITH_ASAN we build
boost.context with context-impl=ucontext and give consumers BOOST_USE_ASAN and
BOOST_USE_UCONTEXT through Boost::context's INTERFACE_COMPILE_DEFINITIONS, but
we never pass BOOST_USE_ASAN to b2.  So libboost_context, which compiles
fiber_activation_record_initializer() and allocates the record, uses the
smaller no-ASan layout, while consumers that include the header (here rgw's
RGWSI_Notify::do_start via boost::asio::spawn) compile resume() with the larger
layout and read stack_bottom/stack_size past the allocation.

Pass define=BOOST_USE_ASAN to b2 so the library and its consumers agree on the
struct layout.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
CMakeLists.txt
cmake/modules/BuildBoost.cmake