Skip to content

Commit

Permalink
[asan] add address sanitizer support to docker-sonic-vs (#10470)
Browse files Browse the repository at this point in the history
- Why I did it
To support docker-sonic-vs image with ASAN.

- How I did it
1. Made the supervisord.conf a template
2. Added the 'log_path' environment variable for ASAN-enabled daemons
3. Added supervisord.conf.j2 generation and ASAN lib to the docker-sonic-vs/Dockerfile.j2

- How to verify it
1. Made a build with ENABLE_ASAN=y
2. Run the tests, checked ASAN reports

Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
  • Loading branch information
Yakiv-Huryk authored and pull[bot] committed Jul 13, 2024
1 parent 2373ca9 commit 74264d9
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
9 changes: 8 additions & 1 deletion platform/vs/docker-sonic-vs/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ RUN apt-get install -y net-tools \
gir1.2-glib-2.0 \
libdbus-1-3 \
libgirepository-1.0-1 \
{%- if ENABLE_ASAN == "y" %}
libasan5 \
{%- endif %}
libsystemd0

# Install redis-server
Expand Down Expand Up @@ -160,7 +163,7 @@ RUN sed -ri 's/^(save .*$)/# \1/g;
COPY ["50-default.conf", "/etc/rsyslog.d/"]
COPY ["start.sh", "orchagent.sh", "files/update_chassisdb_config", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"]
COPY ["files/configdb-load.sh", "/usr/bin/"]
COPY ["files/arp_update", "/usr/bin/"]
COPY ["files/buffers_config.j2", "files/qos_config.j2", "files/arp_update_vars.j2", "files/copp_cfg.j2", "/usr/share/sonic/templates/"]
Expand All @@ -179,6 +182,10 @@ COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/"]
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"]
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
# Workaround the tcpdump issue
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/syncd-asan.log"
{% endif %}

[program:gbsyncd]
command=/usr/bin/syncd -s -p /usr/share/sonic/hwsku/pai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1
Expand All @@ -67,6 +70,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/portsyncd-asan.log"
{% endif %}

[program:orchagent]
command=/usr/bin/orchagent.sh
Expand All @@ -75,6 +81,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/orchagent-asan.log"
{% endif %}

[program:coppmgrd]
command=/usr/bin/coppmgrd
Expand All @@ -83,6 +92,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/coppmgrd-asan.log"
{% endif %}

[program:neighsyncd]
command=/usr/bin/neighsyncd
Expand All @@ -91,6 +103,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/neighsyncd-asan.log"
{% endif %}

[program:teamsyncd]
command=/usr/bin/teamsyncd
Expand All @@ -99,6 +114,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/teamsyncd-asan.log"
{% endif %}

[program:vlanmgrd]
command=/usr/bin/vlanmgrd
Expand All @@ -107,6 +125,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/vlanmgrd-asan.log"
{% endif %}

[program:intfmgrd]
command=/usr/bin/intfmgrd
Expand All @@ -115,6 +136,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/intfmgrd-asan.log"
{% endif %}

[program:portmgrd]
command=/usr/bin/portmgrd
Expand All @@ -123,6 +147,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/portmgrd-asan.log"
{% endif %}

[program:teammgrd]
command=/usr/bin/teammgrd
Expand All @@ -131,6 +158,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/teammgrd-asan.log"
{% endif %}

[program:zebra]
command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm
Expand Down Expand Up @@ -163,6 +193,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/fpmsyncd-asan.log"
{% endif %}

[program:arp_update]
command=/usr/bin/arp_update
Expand All @@ -179,6 +212,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/buffermgrd-asan.log"
{% endif %}

[program:vrfmgrd]
command=/usr/bin/vrfmgrd
Expand All @@ -187,6 +223,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/vrfmgrd-asan.log"
{% endif %}

[program:restore_neighbors]
command=/usr/bin/restore_neighbors.py
Expand All @@ -205,6 +244,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/nbrmgrd-asan.log"
{% endif %}

[program:vxlanmgrd]
command=/usr/bin/vxlanmgrd
Expand All @@ -213,6 +255,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/vxlanmgrd-asan.log"
{% endif %}

[program:sflowmgrd]
command=/usr/bin/sflowmgrd
Expand All @@ -221,6 +266,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/sflowmgrd-asan.log"
{% endif %}

[program:natmgrd]
command=/usr/bin/natmgrd
Expand All @@ -229,6 +277,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/natmgrd-asan.log"
{% endif %}

[program:natsyncd]
command=/usr/bin/natsyncd
Expand All @@ -237,6 +288,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/natsyncd-asan.log"
{% endif %}

[program:fdbsyncd]
command=/usr/bin/fdbsyncd
Expand All @@ -245,6 +299,9 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/fdbsyncd-asan.log"
{% endif %}

[program:tunnelmgrd]
command=/usr/bin/tunnelmgrd
Expand All @@ -253,3 +310,6 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/tunnelmgrd-asan.log"
{% endif %}

0 comments on commit 74264d9

Please sign in to comment.