[asan] add address sanitizer support to docker-sonic-vs (#10470)

- 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>
This commit is contained in:
Yakiv Huryk 2022-04-22 11:07:07 +03:00 committed by GitHub
parent af5e5c4c94
commit 3abf383d3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 1 deletions

View File

@ -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
@ -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/"]
@ -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

View File

@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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 %}