ustctl: Initialize counter_conf struct to zero
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 8 Dec 2020 23:28:32 +0000 (18:28 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 9 Dec 2020 14:03:22 +0000 (09:03 -0500)
commitdca92811152dcefdec21204f39335ea68b95d6a3
tree61ddcf838e9e7cb98817e1499bad6bb116b1c61c
parent809b929460a19e790b0d4281753b3dd3fdd073a3
ustctl: Initialize counter_conf struct to zero

Issue
=====
This struct is not initialize explicitly and is copied and sent through
a Unix socket to the application. This means we are currently sending
uninitialized data.

Valgrind reports the following:
  ==939806== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
  ==939806==    at 0x519412D: __libc_sendmsg (sendmsg.c:28)
  ==939806==    by 0x519412D: sendmsg (sendmsg.c:25)
  ==939806==    by 0x514D2BF: ustcomm_send_unix_sock (in /usr/local/lib/liblttng-ust-ctl.so.4.0.0)
  ==939806==    by 0x514C0BC: ustctl_send_counter_data_to_ust (in /usr/local/lib/liblttng-ust-ctl.so.4.0.0)
  ==939806==    by 0x4A0B14: send_counter_data_to_ust (event-notifier-error-accounting.c:237)
  ==939806==    by 0x4A046D: event_notifier_error_accounting_register_app (event-notifier-error-accounting.c:311)
  ==939806==    by 0x4B0831: ust_app_setup_event_notifier_group (ust-app.c:3956)
  ==939806==    by 0x495603: thread_dispatch_ust_registration (dispatch.c:394)
  ==939806==    by 0x487552: launch_thread (thread.c:66)
  ==939806==    by 0x5188608: start_thread (pthread_create.c:477)
  ==939806==    by 0x52E2292: clone (clone.S:95)
  ==939806==  Address 0x750fb8e is 46 bytes inside a block of size 228 alloc'd
  ==939806==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==939806==    by 0x514988C: ustctl_duplicate_ust_object_data (in /usr/local/lib/liblttng-ust-ctl.so.4.0.0)
  ==939806==    by 0x4A0426: event_notifier_error_accounting_register_app (event-notifier-error-accounting.c:307)
  ==939806==    by 0x4B0831: ust_app_setup_event_notifier_group (ust-app.c:3956)
  ==939806==    by 0x495603: thread_dispatch_ust_registration (dispatch.c:394)
  ==939806==    by 0x487552: launch_thread (thread.c:66)
  ==939806==    by 0x5188608: start_thread (pthread_create.c:477)
  ==939806==    by 0x52E2292: clone (clone.S:95)

Fix
===
Initialize it to zero.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8ce4753858a3ab3e12b94f26b94a200cef15cb06
liblttng-ust-ctl/ustctl.c
This page took 0.026269 seconds and 4 git commands to generate.