* Add log_path_exe=1 option to {A, L}SAN_OPTIONS.
* Add print_cmdline=true to LSAN_OPTIONS.
* Intruduce LSan suppressions file.
* Set necessary smack rules to {A, L}SAN_OPTIONS, /etc/ld.so.preload
and /lsan.supp files.
Change-Id: I83c8b2c8d0989778fe0ff3d70bed1aaf97faf3d1
Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
-detect_leaks=0
+print_cmdline=true:detect_leaks=1:log_path=/tmp/lsan.log:log_exe_name=1:fast_unwind_on_malloc=false:malloc_context_size=5:suppressions=/lsan.supp:print_suppressions=false
Source21: UBSAN_OPTIONS
Source22: macros.ubsan
Source23: extract-ubsan-logs
+Source24: lsan.supp
Group: Development/Building
Summary: The GNU C Compiler and Support Files
License: GPL-3.0+
# Restore /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
-%package -n lsan-build-env
-Summary: Lsan build environment
+%package -n lsan-runtime-env
+Summary: LSan runtime environment
Group: Development/Libraries
Requires: liblsan
+Requires(post): smack
-%description -n lsan-build-env
-Lsan build environment
+%description -n lsan-runtime-env
+LSan runtime environment
-%post -n lsan-build-env
+%post -n lsan-runtime-env
# Add /usr/lib64/liblsan.so to /etc/ld.so.preload
[ -f /etc/ld.so.preload ] && mv -v /etc/ld.so.preload /etc/ld.so.preload.orig
-echo "liblsan.so" > /etc/ld.so.preload
+echo "%{libdir}/liblsan.so" > /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
+chsmack -a "_" /etc/ld.so.preload /LSAN_OPTIONS /lsan.supp
-%preun -n lsan-build-env
+%preun -n lsan-runtime-env
# Restore /etc/ld.so.preload
mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
Group: Development/Tools
BuildArch: noarch
Requires: binutils python
+Requires(post): smack
%description -n sanitizer-devel
The package contatins platform-independent tools for sanitization:
echo "%{libdir}/libasan.so" > /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
-echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log" > /ASAN_OPTIONS
+echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log:log_exe_path=1" > /ASAN_OPTIONS
+chsmack -a "_" /etc/ld.so.preload /ASAN_OPTIONS
%preun -n asan-runtime-env
# Restore /etc/ld.so.preload
chmod 644 %{buildroot}/ASAN_OPTIONS
%ifarch %lsan_arch
-cp %{SOURCE19} %{buildroot}
+cp %{SOURCE19} %{SOURCE24} %{buildroot}
chmod 644 %{buildroot}/LSAN_OPTIONS
+chmod 644 %{buildroot}/lsan.supp
%endif
cd ../
%defattr(-,root,root,-)
%ifarch %lsan_arch
-%files -n lsan-build-env
+%files -n lsan-runtime-env
%defattr(-,root,root,-)
/LSAN_OPTIONS
+/lsan.supp
%endif
%ifarch %ubsan_arch
Source21: UBSAN_OPTIONS
Source22: macros.ubsan
Source23: extract-ubsan-logs
+Source24: lsan.supp
Group: Development/Building
Summary: The GNU C Compiler and Support Files
License: GPL-3.0+
# Restore /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
-%package -n lsan-build-env
-Summary: Lsan build environment
+%package -n lsan-runtime-env
+Summary: LSan runtime environment
Group: Development/Libraries
Requires: liblsan
+Requires(post): smack
-%description -n lsan-build-env
-Lsan build environment
+%description -n lsan-runtime-env
+LSan runtime environment
-%post -n lsan-build-env
+%post -n lsan-runtime-env
# Add /usr/lib64/liblsan.so to /etc/ld.so.preload
[ -f /etc/ld.so.preload ] && mv -v /etc/ld.so.preload /etc/ld.so.preload.orig
-echo "liblsan.so" > /etc/ld.so.preload
+echo "%{libdir}/liblsan.so" > /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
+chsmack -a "_" /etc/ld.so.preload /LSAN_OPTIONS /lsan.supp
-%preun -n lsan-build-env
+%preun -n lsan-runtime-env
# Restore /etc/ld.so.preload
mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
Group: Development/Tools
BuildArch: noarch
Requires: binutils python
+Requires(post): smack
%description -n sanitizer-devel
The package contatins platform-independent tools for sanitization:
echo "%{libdir}/libasan.so" > /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
-echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log" > /ASAN_OPTIONS
+echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log:log_exe_path=1" > /ASAN_OPTIONS
+chsmack -a "_" /etc/ld.so.preload /ASAN_OPTIONS
%preun -n asan-runtime-env
# Restore /etc/ld.so.preload
chmod 644 %{buildroot}/ASAN_OPTIONS
%ifarch %lsan_arch
-cp %{SOURCE19} %{buildroot}
+cp %{SOURCE19} %{SOURCE24} %{buildroot}
chmod 644 %{buildroot}/LSAN_OPTIONS
+chmod 644 %{buildroot}/lsan.supp
%endif
cd ../
%defattr(-,root,root,-)
%ifarch %lsan_arch
-%files -n lsan-build-env
+%files -n lsan-runtime-env
%defattr(-,root,root,-)
/LSAN_OPTIONS
+/lsan.supp
%endif
%ifarch %ubsan_arch
Source21: UBSAN_OPTIONS
Source22: macros.ubsan
Source23: extract-ubsan-logs
+Source24: lsan.supp
Group: Development/Building
Summary: The GNU C Compiler and Support Files
License: GPL-3.0+
# Restore /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
-%package -n lsan-build-env
-Summary: Lsan build environment
+%package -n lsan-runtime-env
+Summary: LSan runtime environment
Group: Development/Libraries
Requires: liblsan
+Requires(post): smack
-%description -n lsan-build-env
-Lsan build environment
+%description -n lsan-runtime-env
+LSan runtime environment
-%post -n lsan-build-env
+%post -n lsan-runtime-env
# Add /usr/lib64/liblsan.so to /etc/ld.so.preload
[ -f /etc/ld.so.preload ] && mv -v /etc/ld.so.preload /etc/ld.so.preload.orig
-echo "liblsan.so" > /etc/ld.so.preload
+echo "%{libdir}/liblsan.so" > /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
+chsmack -a "_" /etc/ld.so.preload /LSAN_OPTIONS /lsan.supp
-%preun -n lsan-build-env
+%preun -n lsan-runtime-env
# Restore /etc/ld.so.preload
mv -v /etc/ld.so.preload.orig /etc/ld.so.preload
Group: Development/Tools
BuildArch: noarch
Requires: binutils python
+Requires(post): smack
%description -n sanitizer-devel
The package contatins platform-independent tools for sanitization:
echo "%{libdir}/libasan.so" > /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && cat /etc/ld.so.preload.orig >> /etc/ld.so.preload
[ -f /etc/ld.so.preload.orig ] && rm -f /etc/ld.so.preload.orig
-echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log" > /ASAN_OPTIONS
+echo "halt_on_error=false:start_deactivated=true:print_cmdline=true:quarantine_size_mb=1:detect_leaks=0:log_path=/tmp/asan.log:log_exe_path=1" > /ASAN_OPTIONS
+chsmack -a "_" /etc/ld.so.preload /ASAN_OPTIONS
%preun -n asan-runtime-env
# Restore /etc/ld.so.preload
chmod 644 %{buildroot}/ASAN_OPTIONS
%ifarch %lsan_arch
-cp %{SOURCE19} %{buildroot}
+cp %{SOURCE19} %{SOURCE24} %{buildroot}
chmod 644 %{buildroot}/LSAN_OPTIONS
+chmod 644 %{buildroot}/lsan.supp
%endif
cd ../
%defattr(-,root,root,-)
%ifarch %lsan_arch
-%files -n lsan-build-env
+%files -n lsan-runtime-env
%defattr(-,root,root,-)
/LSAN_OPTIONS
+/lsan.supp
%endif
%ifarch %ubsan_arch
--- /dev/null
+leak:g_hash_table_new_full