Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mellanox][asan] add address sanitizer support for syncd #10266

Merged
merged 3 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ start() {
{%- endif %}
{%- if docker_container_name == "swss" %}
-e ASIC_VENDOR={{ sonic_asic_platform }} \
{%- if enable_asan == "y" %}
-v /var/log/asan/:/var/log/asan \
{%- endif -%}
{%- if docker_container_name in ["swss", "syncd"] and enable_asan == "y" %}
-v /var/log/asan/:/var/log/asan \
{%- endif -%}
{%- if docker_container_name == "bgp" %}
-v /etc/sonic/frr/$DEV:/etc/frr:rw \
Expand Down Expand Up @@ -493,7 +493,7 @@ stop() {
{%- elif docker_container_name == "teamd" %}
# Longer timeout of 60 sec to wait for Portchannels to be cleaned.
/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
{%- else %}
/usr/local/bin/container stop $DOCKERNAME
Expand Down
4 changes: 3 additions & 1 deletion files/build_templates/sonic_version.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ built_by: {{ built_by }}
{{ name }}: {{ version }}
{% endfor -%}
{% endif -%}

{% if ENABLE_ASAN == "y" -%}
asan: 'yes'
{% endif -%}
9 changes: 8 additions & 1 deletion platform/mellanox/docker-syncd-mlnx/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ RUN apt-get update && \
libxml2 \
python-pip \
python-dev \
{%- if ENABLE_ASAN == "y" %}
libasan5 \
{%- endif %}
python-setuptools

RUN pip2 install --upgrade pip
Expand Down Expand Up @@ -58,8 +61,12 @@ RUN apt-get clean -y && \
apt-get autoremove -y && \
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 ["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"]
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/syncd-asan.log"
{% endif %}