[Mellanox][asan] add address sanitizer support for syncd (#10266)
Why I did it To support address sanitizer for Mellanox syncd How I did it /var/log/asan is mapped for syncd container (the same as for swss) container stop() has a timeout (60s) for syncd (the same as for swss) This is so libasan has enough time to generate a report. added ASAN's log path to Mellanox syncd supervisord.conf added "asan: yes" to sonic_version.yml How to verify it Added artificial memory leaks Compiled with ENABLE_ASAN=y Installed the image on DUT Rebooted the DUT Verified that /var/log/asan/syncd-asan.log contains the leaks Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
This commit is contained in:
parent
0191300b96
commit
d9117d9411
@ -435,9 +435,9 @@ start() {
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if docker_container_name == "swss" %}
|
{%- if docker_container_name == "swss" %}
|
||||||
-e ASIC_VENDOR={{ sonic_asic_platform }} \
|
-e ASIC_VENDOR={{ sonic_asic_platform }} \
|
||||||
{%- if enable_asan == "y" %}
|
|
||||||
-v /var/log/asan/:/var/log/asan \
|
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
{%- if docker_container_name in ["swss", "syncd"] and enable_asan == "y" %}
|
||||||
|
-v /var/log/asan/:/var/log/asan \
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if docker_container_name == "bgp" %}
|
{%- if docker_container_name == "bgp" %}
|
||||||
-v /etc/sonic/frr/$DEV:/etc/frr:rw \
|
-v /etc/sonic/frr/$DEV:/etc/frr:rw \
|
||||||
@ -499,7 +499,7 @@ stop() {
|
|||||||
{%- elif docker_container_name == "teamd" %}
|
{%- elif docker_container_name == "teamd" %}
|
||||||
# Longer timeout of 60 sec to wait for Portchannels to be cleaned.
|
# Longer timeout of 60 sec to wait for Portchannels to be cleaned.
|
||||||
/usr/local/bin/container stop -t 60 $DOCKERNAME
|
/usr/local/bin/container stop -t 60 $DOCKERNAME
|
||||||
{%- elif docker_container_name == "swss" and enable_asan == "y" %}
|
{%- elif docker_container_name in ["swss", "syncd"] and enable_asan == "y" %}
|
||||||
/usr/local/bin/container stop -t 60 $DOCKERNAME
|
/usr/local/bin/container stop -t 60 $DOCKERNAME
|
||||||
{%- else %}
|
{%- else %}
|
||||||
/usr/local/bin/container stop $DOCKERNAME
|
/usr/local/bin/container stop $DOCKERNAME
|
||||||
|
@ -26,4 +26,6 @@ built_by: {{ built_by }}
|
|||||||
{{ name }}: {{ version }}
|
{{ name }}: {{ version }}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
{% if ENABLE_ASAN == "y" -%}
|
||||||
|
asan: 'yes'
|
||||||
|
{% endif -%}
|
||||||
|
@ -31,6 +31,9 @@ RUN apt-get update && \
|
|||||||
libxml2 \
|
libxml2 \
|
||||||
python-pip \
|
python-pip \
|
||||||
python-dev \
|
python-dev \
|
||||||
|
{%- if ENABLE_ASAN == "y" %}
|
||||||
|
libasan5 \
|
||||||
|
{%- endif %}
|
||||||
python-setuptools
|
python-setuptools
|
||||||
|
|
||||||
RUN pip2 install --upgrade pip
|
RUN pip2 install --upgrade pip
|
||||||
@ -58,8 +61,12 @@ RUN apt-get clean -y && \
|
|||||||
apt-get autoremove -y && \
|
apt-get autoremove -y && \
|
||||||
rm -rf /debs
|
rm -rf /debs
|
||||||
|
|
||||||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"]
|
||||||
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
||||||
COPY ["critical_processes", "/etc/supervisor/"]
|
COPY ["critical_processes", "/etc/supervisor/"]
|
||||||
|
|
||||||
|
RUN mkdir -p /etc/supervisor/conf.d/
|
||||||
|
RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
RUN rm -f /usr/share/sonic/templates/supervisord.conf.j2
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/supervisord"]
|
ENTRYPOINT ["/usr/local/bin/supervisord"]
|
||||||
|
@ -37,3 +37,6 @@ stdout_logfile=syslog
|
|||||||
stderr_logfile=syslog
|
stderr_logfile=syslog
|
||||||
dependent_startup=true
|
dependent_startup=true
|
||||||
dependent_startup_wait_for=rsyslogd:running
|
dependent_startup_wait_for=rsyslogd:running
|
||||||
|
{% if ENABLE_ASAN == "y" %}
|
||||||
|
environment=ASAN_OPTIONS="log_path=/var/log/asan/syncd-asan.log"
|
||||||
|
{% endif %}
|
Reference in New Issue
Block a user