Skip to content

[202511] BROADCOM_LEGACY_SAI_COMPAT: Allow platforms to disable sai_query_stats_st_capability at runtime#1795

Merged
vmittal-msft merged 1 commit intosonic-net:202511from
lipxu:fix/brcm-legacy-compat-issue1
Mar 17, 2026
Merged

[202511] BROADCOM_LEGACY_SAI_COMPAT: Allow platforms to disable sai_query_stats_st_capability at runtime#1795
vmittal-msft merged 1 commit intosonic-net:202511from
lipxu:fix/brcm-legacy-compat-issue1

Conversation

@lipxu
Copy link
Contributor

@lipxu lipxu commented Mar 16, 2026

Problem

Backport of #1788 to 202511.

On Arista 7060cx (BCM56960/Tomahawk-1) running the broadcom-legacy image, syncd crashes with SIGSEGV inside brcm_sai_st_pd_ctr_cap_list_get at startup. The legacy SAI binary does not initialize p_pdapi_st->vtable for TH1, so dereferencing it at offset +0x10 causes a segfault.

Root cause: commit 4f1d7d99 restored sai_query_stats_st_capability to AC_CHECK_FUNCS. Because XGS SAI headers are shared across all broadcom builds, the symbol is found at compile time and called at runtime on TH1 where it crashes.

Fix

Add a runtime guard in VendorSai::apiInitialize(): read SAI_STATS_ST_CAPABILITY_SUPPORTED from sai.profile. If set to 0, null the query_stats_st_capability function pointer before marking the API as initialized. The existing null-check in queryStatsStCapability() then safely skips the call.

This fix must be deployed together with the companion buildimage PR that adds SAI_STATS_ST_CAPABILITY_SUPPORTED=0 to the Arista 7060cx sai.profile files.

Related

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lipxu lipxu force-pushed the fix/brcm-legacy-compat-issue1 branch from 9acdcc8 to ed2765f Compare March 16, 2026 04:43
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vmittal-msft
Copy link
Contributor

@lipxu please help fix conflicts

…_st_capability at runtime

Signed-off-by: Liping Xu <xuliping@microsoft.com>
@lipxu lipxu force-pushed the fix/brcm-legacy-compat-issue1 branch from ed2765f to f290766 Compare March 16, 2026 22:03
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Ryangwaite Ryangwaite self-requested a review March 17, 2026 01:43
@vmittal-msft vmittal-msft merged commit b33f9bc into sonic-net:202511 Mar 17, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants