From d12e67b0bc8e57b17d9e7e77e07030b8595ed33b Mon Sep 17 00:00:00 2001
From: laurent <laurent Thomas>
Date: Mon, 17 Apr 2023 09:32:31 +0200
Subject: [PATCH] Enable undefined behavior sanitizer in physim image

---
 docker/Dockerfile.phySim.rhel8.2 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2
index 57896df5732..df1e5af51cf 100644
--- a/docker/Dockerfile.phySim.rhel8.2
+++ b/docker/Dockerfile.phySim.rhel8.2
@@ -31,14 +31,14 @@ RUN rm -Rf /oai-ran
 WORKDIR /oai-ran
 COPY . .
 
-#only install address sanitizer for this container, the others don't need it
-RUN yum install -y libasan
+#only install address and undefined behavior sanitizer for this container, the others don't need it
+RUN yum install -y libasan libubsan
 
 #run build_oai to build the target image
 RUN /bin/sh oaienv && \ 
     cd cmake_targets && \
     mkdir -p log && \
-    ./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
+    ./build_oai --phy_simulators --ninja --verbose-ci --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
 
 #start from scratch for target executable
 FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim
@@ -87,6 +87,7 @@ COPY --from=phy-sim-build \
     /lib64/libexslt.so.0 \
     /lib64/libxslt.so.1 \
     /usr/lib64/libasan.so.5 \
+    /usr/lib64/libubsan.so.1 \
     /oai-ran/cmake_targets/ran_build/build/libdfts.so \
     /oai-ran/cmake_targets/ran_build/build/libldpc.so \
     /oai-ran/cmake_targets/ran_build/build/libldpc_orig.so \
-- 
GitLab