Skip to content

Commit 610ecd2

Browse files
committed
Avoid valgrind warnings about uninitialized memory from SoftHSM
1 parent f4f0a24 commit 610ecd2

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

.github/setup-valgrind.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ if [ "$1" == "valgrind" -o "$2" == "valgrind" ]; then
88
./configure --disable-notify
99
make clean && make -j 4 V=1
1010

11-
# suppression file contains supressions for the notification support which leaks memory
12-
# The other option would be to build without the notification support.
13-
# export VALGRIND="valgrind --error-exitcode=1 --leak-check=full --keep-debuginfo=yes --suppressions=$PWD/tests/opensc.supp"
14-
export VALGRIND="valgrind -q --error-exitcode=1 --leak-check=full --keep-debuginfo=yes --trace-children=yes --gen-suppressions=all"
11+
# suppression file contains supressions for softhsm providing us with uninitialized mechanism flags
12+
# https://github.com/opendnssec/SoftHSMv2/commit/f94aaffc879ade97a51b8e1308af42f86be1885f
13+
export VALGRIND="valgrind -q --error-exitcode=1 --leak-check=full --keep-debuginfo=yes --trace-children=yes --gen-suppressions=all --suppressions=$PWD/tests/opensc.supp"
1514
# this should help us getting better traces as some of pcsclite and avoid false positives
1615
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libpcsclite.so.1"
1716
fi

tests/Makefile.am

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ AM_TESTS_ENVIRONMENT = \
1212

1313
@VALGRIND_CHECK_RULES@
1414
if VALGRIND_ENABLED
15-
#VALGRIND_SUPPRESSIONS_FILES = opensc.supp
16-
#EXTRA_DIST = opensc.supp
15+
VALGRIND_SUPPRESSIONS_FILES = $(srcdir)/opensc.supp
16+
EXTRA_DIST += opensc.supp
1717
VALGRIND_FLAGS = --num-callers=30 -q --keep-debuginfo=yes --gen-suppressions=all
1818
# Do not run the bash scripts under valgrind
1919
LOG_COMPILER = $(LOG_VALGRIND)

tests/opensc.supp

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
SoftHSM provides us with uninitialized flags
3+
Memcheck:Cond
4+
fun:supported_mechanisms_test
5+
obj:/usr/lib/x86_64-linux-gnu/libcmocka.so.0.7.0
6+
fun:_cmocka_run_group_tests
7+
fun:main
8+
}
9+
{
10+
SoftHSM provides us with uninitialized flags
11+
Memcheck:Cond
12+
fun:get_mechanism_all_flag_name
13+
fun:supported_mechanisms_test
14+
obj:/usr/lib/x86_64-linux-gnu/libcmocka.so.0.7.0
15+
fun:_cmocka_run_group_tests
16+
fun:main
17+
}
18+
{
19+
SoftHSM provides us with uninitialized flags
20+
Memcheck:Cond
21+
fun:_itoa_word
22+
fun:__vfprintf_internal
23+
fun:printf
24+
fun:supported_mechanisms_test
25+
obj:/usr/lib/x86_64-linux-gnu/libcmocka.so.0.7.0
26+
fun:_cmocka_run_group_tests
27+
fun:main
28+
}
29+
{
30+
SoftHSM provides us with uninitialized flags
31+
Memcheck:Value8
32+
fun:_itoa_word
33+
fun:__vfprintf_internal
34+
fun:printf
35+
fun:supported_mechanisms_test
36+
obj:/usr/lib/x86_64-linux-gnu/libcmocka.so.0.7.0
37+
fun:_cmocka_run_group_tests
38+
fun:main
39+
}

0 commit comments

Comments
 (0)