Fix: sessiond: uninitialized bytes sent to lttng-ust
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 6 Jun 2022 19:48:16 +0000 (15:48 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 5 Oct 2022 14:31:47 +0000 (10:31 -0400)
Valgrind reports:

==3421594== Thread 9 UST registratio:
==3421594== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
==3421594==    at 0x4DCA12D: __libc_sendmsg (sendmsg.c:28)
==3421594==    by 0x4DCA12D: sendmsg (sendmsg.c:25)
==3421594==    by 0x4B6BDE2: ustcomm_send_unix_sock (ustcomm.c:323)
==3421594==    by 0x4B31549: lttng_ust_ctl_send_counter_data_to_ust (ustctl.c:3167)
==3421594==    by 0x18E8D8: send_counter_data_to_ust(ust_app*, lttng_ust_abi_object_data*) (event-notifier-error-accounting.cpp:535)
==3421594==    by 0x18EDE4: event_notifier_error_accounting_register_app(ust_app*) (event-notifier-error-accounting.cpp:647)
==3421594==    by 0x1AA796: ust_app_setup_event_notifier_group(ust_app*) (ust-app.cpp:4252)
==3421594==    by 0x184AC1: thread_dispatch_ust_registration(void*) (dispatch.cpp:420)
==3421594==    by 0x178192: launch_thread(void*) (thread.cpp:68)
==3421594==    by 0x4DBE608: start_thread (pthread_create.c:477)
==3421594==    by 0x4EF8162: clone (clone.S:95)

==3421594==  Address 0x6f3e2fc is 28 bytes inside a block of size 192 alloc'd
==3421594==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3421594==    by 0x4B2BC3F: zmalloc (macros.h:23)
==3421594==    by 0x4B2BC3F: lttng_ust_ctl_duplicate_ust_object_data (ustctl.c:1332)
==3421594==    by 0x18ED4F: event_notifier_error_accounting_register_app(ust_app*) (event-notifier-error-accounting.cpp:638)
==3421594==    by 0x1AA796: ust_app_setup_event_notifier_group(ust_app*) (ust-app.cpp:4252)
==3421594==    by 0x184AC1: thread_dispatch_ust_registration(void*) (dispatch.cpp:420)
==3421594==    by 0x178192: launch_thread(void*) (thread.cpp:68)
==3421594==    by 0x4DBE608: start_thread (pthread_create.c:477)
==3421594==    by 0x4EF8162: clone (clone.S:95)

==3421594==  Uninitialised value was created by a stack allocation
==3421594==    at 0x18DCF3: ust_error_accounting_entry_create(ust_app const*) (event-notifier-error-accounting.cpp:377)

The underflow/overflow indices are left uninitialized and are ultimately
sent.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6dfff2e39a8fda0e74dd874ab34be66845629069

src/bin/lttng-sessiond/event-notifier-error-accounting.cpp

index 70ffb86ef01bf74a8423d54c9202774102b763e9..85327c2167b648d38541dcb282cdf2ca613f7908 100644 (file)
@@ -378,7 +378,7 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create(
        struct lttng_ust_ctl_daemon_counter *daemon_counter;
        struct lttng_ust_abi_object_data *counter, **cpu_counters;
        struct ust_error_accounting_entry *entry = NULL;
-       lttng_ust_ctl_counter_dimension dimension;
+       lttng_ust_ctl_counter_dimension dimension = {};
 
        dimension.size = ust_state.number_indices;
        dimension.has_underflow = false;
This page took 0.026718 seconds and 4 git commands to generate.