Commit 4893c73c authored by Stef Walter's avatar Stef Walter Committed by Stef Walter
Browse files

Valgrind integration, refactor build process

 * Cleanup secure memory allocator for valgrind.
 * Bring valgrind headers in.
 * Add lots of suppressions for glib, gdbus, gcrypt
 * Fix up a bunch of bugs where things weren't getting freed
 * Add new 'make check-memory' target
parent e670fe56
......@@ -3,6 +3,7 @@
*.la
*.lo
*.pyc
*.gcov
*.gcno
*.gcda
.deps
......@@ -19,7 +20,6 @@ install-sh
INSTALL
libtool
ltmain.sh
m4
Makefile
Makefile.in
Makefile.in.in
......@@ -29,9 +29,12 @@ stamp*
.project
.cproject
/coverage
/build/coverage
/build/m4
/build/valgrind-built.supp
/po/POTFILES
/po/gsecret.pot
/egg/tests/test-dh
/egg/tests/test-hkdf
......@@ -40,3 +43,4 @@ stamp*
/library/gsecret-dbus-generated.[ch]
/library/tests/test-*
!/library/tests/test-*.c
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/Makefile.decl
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
ACLOCAL_AMFLAGS = -I build/m4 ${ACLOCAL_FLAGS}
SUBDIRS = po egg library
SUBDIRS = build po egg library
DISTCHECK_CONFIGURE_FLAGS = \
--enable-debug=yes \
......@@ -23,13 +23,19 @@ dist-hook:
echo A git clone is required to generate a ChangeLog >&2; \
fi
check-memory:
@for subdir in $(SUBDIRS); do \
test -d $(builddir)/$$subdir/tests && \
make -C $(builddir)/$$subdir/tests check-memory; \
done
if WITH_COVERAGE
coverage:
mkdir -p coverage
$(LCOV) --directory . --capture --output-file coverage/coverage.info
$(GENHTML) --output-directory coverage coverage/coverage.info
mkdir -p build/coverage
$(LCOV) --directory . --capture --output-file build/coverage/coverage.info
$(GENHTML) --output-directory coverage build/coverage/coverage.info
$(LCOV) --directory . --zerocounters
@echo "file://$(abs_top_builddir)/coverage/index.html"
@echo "file://$(abs_top_builddir)/build/coverage/index.html"
clear-coverage:
$(LCOV) --directory . --zerocounters
......
NULL =
perform-memcheck: $(TEST_PROGS) $(top_builddir)/build/valgrind-built.supp
@for test in $(TEST_PROGS); do \
G_SLICE=always-malloc libtool --mode=execute \
valgrind --trace-children=no --gen-suppressions=all \
--suppressions=$(top_builddir)/build/valgrind-built.supp \
--leak-check=full --show-reachable=yes --num-callers=16 \
--quiet --error-exitcode=33 \
$(builddir)/$$test; \
done
VALGRIND_CONTRIB = \
valgrind.h \
memcheck.h
SUPPRESSIONS = \
gcrypt.supp \
glib.supp \
pthread.supp \
unknown.supp
valgrind-built.supp: $(SUPPRESSIONS)
$(AM_V_GEN) cat $(SUPPRESSIONS) > $@
EXTRA_DIST = \
$(VALGRIND_CONTRIB) \
$(SUPPRESSIONS)
all-local: valgrind-built.supp
\ No newline at end of file
{
gpg_err_init
Memcheck:Leak
...
fun:gpg_err_init
}
{
_gcry_module_add
Memcheck:Leak
...
fun:_gcry_module_add
}
{
g_type_register_static_1
Memcheck:Leak
...
fun:g_type_register_static
}
{
g_type_register_fundamental
Memcheck:Leak
...
fun:g_type_register_fundamental
}
{
g_type_init_with_debug_flags
Memcheck:Leak
...
fun:g_type_init_with_debug_flags
}
{
g_type_class_ref_1
Memcheck:Leak
...
fun:type_iface_vtable_base_init_Wm
...
fun:g_type_class_ref
}
{
g_type_class_ref_2
Memcheck:Leak
...
fun:type_class_init_Wm
...
fun:g_type_class_ref
}
{
g_type_add_interface_static
Memcheck:Leak
...
fun:g_type_add_interface_static
}
{
g_param_spec_internal
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_type_create_instance
fun:g_param_spec_internal
}
{
g_param_spec_enum
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_param_spec_enum
}
{
g_param_spec_flags
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_param_spec_flags
}
{
g_quark_from_static_string
Memcheck:Leak
...
fun:g_quark_from_static_string
}
{
g_quark_from_string
Memcheck:Leak
...
fun:g_quark_from_string
}
{
g_value_register_transform_func
Memcheck:Leak
...
fun:g_value_register_transform_func
}
{
test_run_seed
Memcheck:Leak
...
fun:g_rand_new_with_seed_array
fun:test_run_seed
...
fun:g_test_run_suite
}
{
g_test_init
Memcheck:Leak
...
fun:g_rand_new_with_seed_array
...
fun:g_test_init
}
{
g_intern_static_string
Memcheck:Leak
...
fun:g_intern_static_string
}
{
g_main_context_push_thread_default
Memcheck:Leak
...
fun:g_queue_new
fun:g_main_context_push_thread_default
}
{
g_dbus_error_register_error
Memcheck:Leak
...
fun:g_dbus_error_register_error
}
{
g_param_spec_pool_insert
Memcheck:Leak
...
fun:g_param_spec_pool_insert
}
{
g_main_context_default
Memcheck:Leak
...
fun:g_main_context_default
}
{
g_main_context_check
Memcheck:Leak
...
fun:g_ptr_array_add
fun:g_main_context_check
}
{
g_test_run_suite
Memcheck:Leak
...
fun:g_slist_copy
fun:g_test_run_suite_internal
fun:g_test_run_suite
}
{
g_dbus_interface_info_cache_build
Memcheck:Leak
...
fun:g_dbus_interface_info_cache_build
}
{
g_cancellable_push_current
Memcheck:Leak
...
fun:thread_memory_from_self
...
fun:g_cancellable_push_current
}
{
g_io_scheduler_push_job
Memcheck:Leak
...
fun:init_scheduler
fun:g_once_impl
fun:g_io_scheduler_push_job
}
{
g_io_scheduler_push_job_2
Memcheck:Leak
...
fun:g_system_thread_new
...
fun:g_io_scheduler_push_job
}
{
g_bus_get_sync__available_connections
Memcheck:Leak
...
fun:g_hash_table_new
fun:initable_init
fun:g_initable_init
fun:g_bus_get_sync
}
{
g_socket_connection_factory_register_type
Memcheck:Leak
...
fun:g_socket_connection_factory_register_type
}
{
g_test_add_vtable
Memcheck:Leak
...
fun:g_test_add_vtable
}
{
g_mutex_lock
Memcheck:Leak
...
fun:g_mutex_impl_new
fun:g_mutex_get_impl
fun:g_mutex_lock
}
{
g_thread_self
Memcheck:Leak
...
fun:g_thread_self
}
{
g_rec_mutex_lock
Memcheck:Leak
...
fun:g_rec_mutex_impl_new
fun:g_rec_mutex_get_impl
fun:g_rec_mutex_lock
}
{
test_case_run
Memcheck:Leak
...
fun:g_malloc0
fun:test_case_run
...
fun:g_test_run_suite
}
{
g_get_charset
Memcheck:Leak
...
fun:g_get_charset
}
{
g_test_run_suite__timer_new
Memcheck:Leak
...
fun:g_timer_new
fun:test_case_run
...
fun:g_test_run_suite
}
{
g_test_run_suite__strconcat
Memcheck:Leak
...
fun:g_strconcat
fun:test_case_run
...
fun:g_test_run_suite
fun:g_test_run
}
{
g_type_interface_add_prerequisite
Memcheck:Leak
...
fun:g_type_interface_add_prerequisite
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_slist_copy
fun:g_test_run_suite_internal
...
fun:g_test_run_suite
}
{
g_set_prgname
Memcheck:Leak
...
fun:g_set_prgname
}
{
g_test_run_suite__strconcat_2
Memcheck:Leak
...
fun:g_strconcat
fun:g_test_run_suite_internal
}
{
g_test_run_suite__strdup
Memcheck:Leak
...
fun:g_strdup
fun:g_test_run_suite_internal
}
{
g_private_get
Memcheck:Leak
...
fun:g_private_get
}
{
g_private_set
Memcheck:Leak
...
fun:g_private_set
}
{
g_static_mutex_get_mutex_impl
Memcheck:Leak
...
fun:g_static_mutex_get_mutex_impl
}
{
_dl_allocate_tls
Memcheck:Leak
...
fun:_dl_allocate_tls
fun:pthread_create*
}
{
_g_dbus_shared_thread_ref
Memcheck:Leak
...
fun:_g_dbus_shared_thread_ref
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:standard_malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:g_type_create_instance
fun:g_object_constructor
fun:g_object_newv
fun:g_object_new
fun:g_dbus_message_new
fun:g_dbus_message_new_from_blob
fun:_g_dbus_worker_do_read_cb
fun:g_simple_async_result_complete
fun:complete_in_idle_cb
fun:g_idle_dispatch
fun:g_main_dispatch
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
...
obj:/lib64/libgcrypt.so.11.7.0
fun:egg_dh_gen_pair
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:parse_value_from_blob
fun:g_dbus_message_new_from_blob
fun:_g_dbus_worker_do_read_cb
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_dbus_message_new
fun:g_dbus_message_new_from_blob
fun:_g_dbus_worker_do_read_cb
fun:g_simple_async_result_complete
fun:complete_in_idle_cb
fun:g_idle_dispatch
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_variant_get
fun:g_dbus_message_to_gerror
fun:decode_method_reply
fun:g_dbus_connection_call_done
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_dbus_message_set_header
fun:g_dbus_message_new_from_blob
fun:_g_dbus_worker_do_read_cb
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:standard_malloc
fun:g_malloc
fun:g_malloc_n
fun:g_main_context_iterate
fun:g_main_loop_run
fun:gdbus_shared_thread_func
fun:g_thread_proxy
fun:start_thread
fun:clone
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:standard_malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_list_prepend
fun:g_queue_push_head
fun:g_main_context_push_thread_default
fun:gdbus_shared_thread_func
fun:g_thread_proxy
fun:start_thread
fun:clone
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:standard_malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:get_dispatch
fun:g_main_dispatch
fun:g_main_context_dispatch
fun:g_main_context_iterate
fun:g_main_loop_run
fun:g_dbus_connection_send_message_with_reply_sync
fun:g_dbus_connection_call_sync_internal
fun:g_dbus_connection_call_sync
fun:initable_init
fun:g_initable_init
fun:g_bus_get_sync
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:standard_malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:get_dispatch
fun:g_main_dispatch
fun:g_main_context_dispatch
fun:g_main_context_iterate
fun:g_main_loop_run
fun:gdbus_shared_thread_func
fun:g_thread_proxy
fun:start_thread
fun:clone
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:standard_malloc
fun:g_malloc
fun:g_malloc_n
fun:g_main_context_iterate
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:realloc
fun:standard_realloc
fun:g_realloc
fun:_g_dbus_worker_do_read_unlocked
fun:_g_dbus_worker_do_initial_read
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:_g_socket_output_stream_new
fun:g_socket_connection_get_output_stream
fun:g_io_stream_get_output_stream
fun:_g_dbus_auth_run_client
}
{
_g_dbus_worker_do_initial_read
Memcheck:Leak
...
fun:_g_dbus_worker_do_read_unlocked
fun:_g_dbus_worker_do_initial_read
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_unix_socket_address_new_with_type
fun:g_dbus_address_connect
fun:g_dbus_address_try_connect_one
fun:g_dbus_address_get_stream_sync
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:_g_socket_input_stream_new
fun:g_socket_connection_get_input_stream
fun:g_io_stream_get_input_stream
fun:_g_dbus_auth_run_client
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:_g_dbus_worker_close
fun:_g_dbus_worker_stop
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_simple_async_result_complete_in_idle
fun:_g_socket_read_with_control_messages_ready
fun:_g_socket_read_with_control_messages
fun:_g_dbus_worker_do_read_unlocked
fun:_g_dbus_worker_do_read_cb
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_source_new
fun:g_idle_source_new
fun:g_simple_async_result_complete_in_idle
fun:g_socket_connection_close_async
fun:g_io_stream_close_async
...
fun:gdbus_shared_thread_func
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...