From 21105ef91477a50cec3f8424b410eaedf14fca7b Mon Sep 17 00:00:00 2001 From: Connor Roos Date: Fri, 6 Mar 2026 17:35:49 +0000 Subject: [PATCH 1/6] Add ASAN build rules Signed-off-by: Connor Roos --- debian/control | 13 +++++++++++-- debian/rules | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 22dfa95e54..1de1ee0ee4 100644 --- a/debian/control +++ b/debian/control @@ -7,13 +7,22 @@ Standards-Version: 1.0.0 Package: syncd Architecture: any -Build-Profiles: +Build-Profiles: Depends: ${misc:Pre-Depends} Recommends: ${shlibs:Depends} -Conflicts: syncd-rpc, syncd-vs +Conflicts: syncd-rpc, syncd-vs, syncd-asan Description: This package contains sync daemon for SONiC project. This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI. +Package: syncd-asan +Architecture: any +Build-Profiles: +Depends: ${misc:Pre-Depends} +Recommends: ${shlibs:Depends} +Conflicts: syncd, syncd-rpc, syncd-vs +Description: This package contains ASAN-instrumented sync daemon for SONiC project. + This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI. + Package: syncd-rpc Architecture: any Build-Profiles: diff --git a/debian/rules b/debian/rules index f8df605757..2e202188a6 100755 --- a/debian/rules +++ b/debian/rules @@ -67,7 +67,11 @@ ifneq ($(filter rpc,$(DEB_BUILD_PROFILES)),) make install DESTDIR=$(shell pwd)/debian/tmp dh_install -N syncd else - dh_install +ifneq ($(filter asan,$(DEB_BUILD_PROFILES)),) + dh_install -N syncd +else + dh_install -N syncd-asan +endif endif ifneq ($(filter rpc,$(DEB_BUILD_PROFILES)),) sed -i 's|ENABLE_SAITHRIFT=0|ENABLE_SAITHRIFT=1 # Add a comment to fix https://github.com/Azure/sonic-buildimage/issues/2694 |' debian/syncd-rpc/usr/bin/syncd_init_common.sh From 0923cf72df5b7a5ccd6a3033147d1f86a05f2544 Mon Sep 17 00:00:00 2001 From: Connor Roos Date: Sat, 7 Mar 2026 21:36:59 +0000 Subject: [PATCH 2/6] Update rules and add install Signed-off-by: Connor Roos --- debian/control | 24 ++++++++++++++++++++++++ debian/rules | 30 ++++++++++++++++++++++++++++++ debian/syncd-asan.install | 8 ++++++++ 3 files changed, 62 insertions(+) create mode 100644 debian/syncd-asan.install diff --git a/debian/control b/debian/control index 1de1ee0ee4..dce30be320 100644 --- a/debian/control +++ b/debian/control @@ -42,6 +42,30 @@ Conflicts: syncd-rpc, syncd Description: This package contains sync daemon for SONiC project linked with virtual switch. This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI. +Package: syncd-dbgsym +Architecture: any +Build-Profiles: +Section: debug +Priority: extra +Depends: syncd (= ${binary:Version}) +Description: debugging symbols for syncd + +Package: syncd-asan-dbgsym +Architecture: any +Build-Profiles: +Section: debug +Priority: extra +Depends: syncd-asan (= ${binary:Version}) +Description: debugging symbols for syncd-asan + +Package: syncd-rpc-dbgsym +Architecture: any +Build-Profiles: +Section: debug +Priority: extra +Depends: syncd-rpc (= ${binary:Version}) +Description: debugging symbols for syncd-rpc + Package: libsairedis Architecture: any Depends: ${shlibs:Depends}, ${misc:Pre-Depends} diff --git a/debian/rules b/debian/rules index 2e202188a6..73d867ddb4 100755 --- a/debian/rules +++ b/debian/rules @@ -82,3 +82,33 @@ override_dh_installinit: override_dh_shlibdeps: $(LD_LIBRARY_PATH_CONFIG) dh_shlibdeps -- --ignore-missing-info -xlibsai + +ifneq ($(filter syncd,$(DEB_BUILD_PROFILES)),) +ifneq ($(filter vs,$(DEB_BUILD_PROFILES)),) +SYNCD_STRIP_PKG = +SYNCD_DBG_PKG = +else +ifneq ($(filter rpc,$(DEB_BUILD_PROFILES)),) +SYNCD_STRIP_PKG = syncd-rpc +SYNCD_DBG_PKG = syncd-rpc-dbgsym +else +ifneq ($(filter asan,$(DEB_BUILD_PROFILES)),) +SYNCD_STRIP_PKG = syncd +SYNCD_DBG_PKG = syncd-asan-dbgsym +else +SYNCD_STRIP_PKG = syncd-asan +SYNCD_DBG_PKG = syncd-dbgsym +endif +endif +endif +else +SYNCD_STRIP_PKG = +SYNCD_DBG_PKG = +endif + +override_dh_strip: +ifneq ($(SYNCD_STRIP_PKG),) + dh_strip -p$(SYNCD_STRIP_PKG) --dbg-package=$(SYNCD_DBG_PKG) +else + dh_strip +endif diff --git a/debian/syncd-asan.install b/debian/syncd-asan.install new file mode 100644 index 0000000000..c559f1fea8 --- /dev/null +++ b/debian/syncd-asan.install @@ -0,0 +1,8 @@ +usr/bin/saidump +usr/bin/saiplayer +usr/bin/saisdkdump +usr/bin/saidiscovery +usr/bin/saiasiccmp +usr/bin/syncd* +syncd/scripts/* usr/bin +usr/lib/*/libMdioIpcClient.so.* From 2e054d43a8cf0687df2833bf68858c3b1a8f3805 Mon Sep 17 00:00:00 2001 From: Connor Roos Date: Sat, 14 Mar 2026 17:40:01 +0000 Subject: [PATCH 3/6] Set ASAN and RPC to be mutually exclusive Signed-off-by: Connor Roos --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index dce30be320..6072fbc919 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,7 @@ Description: This package contains sync daemon for SONiC project. Package: syncd-asan Architecture: any -Build-Profiles: +Build-Profiles: Depends: ${misc:Pre-Depends} Recommends: ${shlibs:Depends} Conflicts: syncd, syncd-rpc, syncd-vs @@ -25,7 +25,7 @@ Description: This package contains ASAN-instrumented sync daemon for SONiC proje Package: syncd-rpc Architecture: any -Build-Profiles: +Build-Profiles: Depends: ${misc:Pre-Depends} Recommends: ${shlibs:Depends} Conflicts: syncd, syncd-vs From e3c9c0e9e57b76751cb891116b6d0891c4aa2021 Mon Sep 17 00:00:00 2001 From: Connor Roos Date: Sat, 14 Mar 2026 17:51:06 +0000 Subject: [PATCH 4/6] Remove RPC dbgsym package and address comment Signed-off-by: Connor Roos --- debian/control | 8 -------- debian/rules | 13 ++++--------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/debian/control b/debian/control index 6072fbc919..192f46703a 100644 --- a/debian/control +++ b/debian/control @@ -58,14 +58,6 @@ Priority: extra Depends: syncd-asan (= ${binary:Version}) Description: debugging symbols for syncd-asan -Package: syncd-rpc-dbgsym -Architecture: any -Build-Profiles: -Section: debug -Priority: extra -Depends: syncd-rpc (= ${binary:Version}) -Description: debugging symbols for syncd-rpc - Package: libsairedis Architecture: any Depends: ${shlibs:Depends}, ${misc:Pre-Depends} diff --git a/debian/rules b/debian/rules index 73d867ddb4..3df6f20563 100755 --- a/debian/rules +++ b/debian/rules @@ -83,16 +83,15 @@ override_dh_installinit: override_dh_shlibdeps: $(LD_LIBRARY_PATH_CONFIG) dh_shlibdeps -- --ignore-missing-info -xlibsai -ifneq ($(filter syncd,$(DEB_BUILD_PROFILES)),) -ifneq ($(filter vs,$(DEB_BUILD_PROFILES)),) SYNCD_STRIP_PKG = SYNCD_DBG_PKG = -else + +ifneq ($(filter syncd,$(DEB_BUILD_PROFILES)),) +ifeq ($(filter vs,$(DEB_BUILD_PROFILES)),) ifneq ($(filter rpc,$(DEB_BUILD_PROFILES)),) SYNCD_STRIP_PKG = syncd-rpc SYNCD_DBG_PKG = syncd-rpc-dbgsym -else -ifneq ($(filter asan,$(DEB_BUILD_PROFILES)),) +else ifneq ($(filter asan,$(DEB_BUILD_PROFILES)),) SYNCD_STRIP_PKG = syncd SYNCD_DBG_PKG = syncd-asan-dbgsym else @@ -101,10 +100,6 @@ SYNCD_DBG_PKG = syncd-dbgsym endif endif endif -else -SYNCD_STRIP_PKG = -SYNCD_DBG_PKG = -endif override_dh_strip: ifneq ($(SYNCD_STRIP_PKG),) From 574b79797a6f49c194d3ecdb05ac4655d6330839 Mon Sep 17 00:00:00 2001 From: Connor Roos Date: Sat, 14 Mar 2026 17:55:02 +0000 Subject: [PATCH 5/6] Strip the remaining packages Signed-off-by: Connor Roos --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index 3df6f20563..2dd6c99001 100755 --- a/debian/rules +++ b/debian/rules @@ -104,6 +104,7 @@ endif override_dh_strip: ifneq ($(SYNCD_STRIP_PKG),) dh_strip -p$(SYNCD_STRIP_PKG) --dbg-package=$(SYNCD_DBG_PKG) + dh_strip --remaining-packages else dh_strip endif From e6a8953d4152affe6b3f409bd5eb88db426a7fa4 Mon Sep 17 00:00:00 2001 From: Connor Roos Date: Sat, 14 Mar 2026 17:58:14 +0000 Subject: [PATCH 6/6] Make syncd-asan-dbgsym mutually exclusive with rpc Signed-off-by: Connor Roos --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 192f46703a..915945babd 100644 --- a/debian/control +++ b/debian/control @@ -52,7 +52,7 @@ Description: debugging symbols for syncd Package: syncd-asan-dbgsym Architecture: any -Build-Profiles: +Build-Profiles: Section: debug Priority: extra Depends: syncd-asan (= ${binary:Version})