From 1c6841e6fdc4463167a1b227442dceb98828396b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= <rzarzyns@redhat.com>
Date: Tue, 15 Mar 2022 15:33:41 +0100
Subject: [PATCH] build, crimson/osd: do not let Seastar to interfere with
 ELF's program headers.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

For the sake of avoiding locking on the `__cxa_throw` paths, Seastar
hijacks `dl_iterate_phdr` of the dynamic linker. Unfortunately, this
has a nasty side effect: it makes impossible to catch an exception in
in a plugin (a DSO loaded via the `dlopen()` machinery).

For mote details please consult:
  * https://gist.github.com/rzarzynski/3abe9ed6b50cfa1893d34988e1628bfc,
  * `seastar/src/core/exception_hacks.cc`.

This patch deals with the problem by simply disabling the problematic
workaround which could be iatrogenic too. If that would be the case,
we can consider:

  * preloading all our Ceph Classes before reaching `smp::configure()`,
  * statically linking them.

Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
---
 src/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ebc3cd658a1..3df96d9b84d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -369,6 +369,7 @@ if(WITH_SEASTAR)
     endif()
   endif()
   list(APPEND Seastar_CXX_FLAGS
+    "-DSEASTAR_NO_EXCEPTION_HACK"
     "-Wno-error"
     "-Wno-sign-compare"
     "-Wno-attributes"