Running vhost-user-bridge built with ASAN with stdbuf dies:
==2431898==ASan runtime does not come first in initial library list; you
should either link runtime to your application or manually preload it
with LD_PRELOAD.

Signed-off-by: Marc-André Lureau <[email protected]>
---
 tests/functional/x86_64/test_vhost_user_bridge.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/functional/x86_64/test_vhost_user_bridge.py 
b/tests/functional/x86_64/test_vhost_user_bridge.py
index c36c62542053..5fedf61c5e72 100755
--- a/tests/functional/x86_64/test_vhost_user_bridge.py
+++ b/tests/functional/x86_64/test_vhost_user_bridge.py
@@ -73,12 +73,25 @@ def configure_vm(self, ud_socket_path, lport, rport, 
hostfwd_port, tftpdir):
             "-netdev",   "hubport,id=hub1,hubid=0,netdev=user0"
         )
 
+    @staticmethod
+    def _is_asan_linked(binary_path):
+        try:
+            output = subprocess.check_output(
+                ["ldd", binary_path], stderr=subprocess.DEVNULL, text=True)
+            return "libasan" in output
+        except (subprocess.CalledProcessError, FileNotFoundError):
+            return False
+
     def assemble_vubr_args(self, vubr_path, ud_socket_path, lport, rport):
         vubr_args = []
 
         if (stdbuf_path := which("stdbuf")) is None:
             self.log.info("Could not find stdbuf: vhost-user-bridge "
                           "log lines may appear out of order")
+        elif self._is_asan_linked(vubr_path):
+            self.log.info("vhost-user-bridge is ASan-linked: skipping "
+                          "stdbuf to avoid LD_PRELOAD conflict, "
+                          "log lines may appear out of order")
         else:
             vubr_args += [stdbuf_path, "-o0", "-e0"]
 

-- 
2.55.0.543.g5ebe2ebe4ea8


Reply via email to