1
+ # build with asan
2
+ # - bindings/sce fail to work because of some asan linkage issues presumed
3
+ %bcond_with asan
4
+
1
5
# gconf is a legacy system not used any more, and it blocks testing of oscap-anaconda-addon
2
6
# as gconf is no longer part of the installation medium
3
7
%bcond_with gconf
@@ -23,6 +27,11 @@ BuildRequires: pkg-config
23
27
BuildRequires: systemd-rpm-macros
24
28
BuildRequires: gcc
25
29
BuildRequires: gcc-c++
30
+ %if %{with asan }
31
+ BuildRequires: libasan
32
+ BuildRequires: libasan-static
33
+ BuildRequires: libubsan
34
+ %endif
26
35
27
36
# Try to follow CMakeLists.txt order
28
37
BuildRequires: pkgconfig(libacl)
@@ -126,6 +135,7 @@ The %{name}-utils package contains command-line tools build on top
126
135
of OpenSCAP library. Historically, openscap-utils included oscap
127
136
tool which is now separated to %{name }-scanner sub-package.
128
137
138
+ %if ! %{with asan }
129
139
%package engine-sce
130
140
Summary: Script Check Engine plug-in for OpenSCAP
131
141
Requires: %{name }%{?_isa } = %{epoch }:%{version }-%{release }
@@ -143,6 +153,7 @@ Requires: %{name}-engine-sce%{?_isa} = %{epoch}:%{version}-%{release}
143
153
%description engine-sce-devel
144
154
The %{name }-engine-sce-devel package contains libraries and header files
145
155
for developing applications that use %{name }-engine-sce.
156
+ %endif
146
157
147
158
%package containers
148
159
Summary: Utils for scanning containers
@@ -161,6 +172,12 @@ tar xvzf %{SOURCE1} --directory=yaml-filter --strip-components=1
161
172
%undefine __cmake_in_source_build
162
173
%cmake -G Ninja \
163
174
-DENABLE_DOCS=ON \
175
+ %if %{with asan }
176
+ -DENABLE_ASAN=TRUE \
177
+ -DENABLE_PERL=OFF \
178
+ -DENABLE_PYTHON=OFF \
179
+ -DENABLE_SCE=OFF \
180
+ %endif
164
181
%if ! %{with gconf }
165
182
-DOPENSCAP_PROBE_UNIX_GCONF=OFF \
166
183
-DGCONF_LIBRARY= \
@@ -176,6 +193,11 @@ make docs
176
193
%if %{with check }
177
194
# Tests use common files. Running tests parallel causes failed tests because of that.
178
195
%undefine _smp_mflags
196
+ %if %{with asan }
197
+ # https://github.com/google/sanitizers/wiki/AddressSanitizer
198
+ # - but do not detect leaks, program is not long running, also numerous leaks so fix these completely would require some effort
199
+ export ASAN_OPTIONS=detect_leaks=0:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_invalid_pointer_pairs=2
200
+ %endif
179
201
%ctest
180
202
%endif
181
203
@@ -218,7 +240,9 @@ ln -sf ../oscap-remediate.service %{buildroot}%{_unitdir}/system-update.target.w
218
240
%{_libdir }/libopenscap.so
219
241
%{_libdir }/pkgconfig/* .pc
220
242
%{_includedir }/openscap
243
+ %if ! %{with asan }
221
244
%exclude %{_includedir }/openscap/sce_engine_api.h
245
+ %endif
222
246
223
247
%files scanner
224
248
%{_bindir }/oscap
@@ -245,13 +269,15 @@ ln -sf ../oscap-remediate.service %{buildroot}%{_unitdir}/system-update.target.w
245
269
%{_mandir }/man8/oscap-vm.8*
246
270
%{_mandir }/man8/scap-as-rpm.8*
247
271
272
+ %if ! %{with asan }
248
273
%files engine-sce
249
274
%{_bindir }/oscap-run-sce-script
250
275
%{_libdir }/libopenscap_sce.so.*
251
276
252
277
%files engine-sce-devel
253
278
%{_libdir }/libopenscap_sce.so
254
279
%{_includedir }/openscap/sce_engine_api.h
280
+ %endif
255
281
256
282
%files containers
257
283
%{_bindir }/oscap-docker
0 commit comments