From be3d556d995f266dd2aac1a31f01b0071894c973 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Aug 2020 11:59:33 +0200 Subject: TEMPORARY: all: temporary workaround valgrind failure about uninitalized variables in epoll_wait() On Fedora rawhide/33 (x64_86), our unit tests fail under valgrind with: ./src/devices/tests/test-acd.valgrind-log:==48770== Conditional jump or move depends on uninitialised value(s) ./src/devices/tests/test-acd.valgrind-log:==48770== at 0x448EDA: n_acd_dispatch (n-acd.c:908) ./src/devices/tests/test-acd.valgrind-log:==48770== by 0x446B1C: acd_event (nm-acd-manager.c:183) ./src/devices/tests/test-acd.valgrind-log:==48770== by 0x4E8EEAE: g_main_dispatch (gmain.c:3309) ./src/devices/tests/test-acd.valgrind-log:==48770== by 0x4E8EEAE: g_main_context_dispatch (gmain.c:3974) and similar. Valgrind complains that the event data from epoll_wait() is not initialized. As temporary workaround, initialize the values to get CI passing. Usually we wouldn't add such workaround, but CI tests on rawhide fail for other reasons too, and this blocks fixing those issues. We need CI to pass. See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1844778#c10 --- shared/n-acd/src/n-acd.c | 2 +- shared/n-dhcp4/src/n-dhcp4-client.c | 2 +- src/systemd/src/libsystemd/sd-event/sd-event.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shared/n-acd/src/n-acd.c b/shared/n-acd/src/n-acd.c index c1d9286503..02383ea6bf 100644 --- a/shared/n-acd/src/n-acd.c +++ b/shared/n-acd/src/n-acd.c @@ -893,7 +893,7 @@ static int n_acd_dispatch_socket(NAcd *acd, struct epoll_event *event) { * on failure. */ _c_public_ int n_acd_dispatch(NAcd *acd) { - struct epoll_event events[2]; + struct epoll_event events[2] = { }; int n, i, r = 0; n = epoll_wait(acd->fd_epoll, events, sizeof(events) / sizeof(*events), 0); diff --git a/shared/n-dhcp4/src/n-dhcp4-client.c b/shared/n-dhcp4/src/n-dhcp4-client.c index 1dedbf30c8..29363fbfbe 100644 --- a/shared/n-dhcp4/src/n-dhcp4-client.c +++ b/shared/n-dhcp4/src/n-dhcp4-client.c @@ -755,7 +755,7 @@ static int n_dhcp4_client_dispatch_io(NDhcp4Client *client, struct epoll_event * * there is more data to dispatch. */ _c_public_ int n_dhcp4_client_dispatch(NDhcp4Client *client) { - struct epoll_event events[2]; + struct epoll_event events[2] = { }; int n, i, r = 0; n = epoll_wait(client->fd_epoll, events, sizeof(events) / sizeof(*events), 0); diff --git a/src/systemd/src/libsystemd/sd-event/sd-event.c b/src/systemd/src/libsystemd/sd-event/sd-event.c index 8b7691d0a6..280ea16c5b 100644 --- a/src/systemd/src/libsystemd/sd-event/sd-event.c +++ b/src/systemd/src/libsystemd/sd-event/sd-event.c @@ -3537,6 +3537,8 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) { if (e->inotify_data_buffered) timeout = 0; + memset (e->event_queue, 0, event_queue_max * sizeof (e->event_queue[0])); + m = epoll_wait(e->epoll_fd, e->event_queue, event_queue_max, timeout == (uint64_t) -1 ? -1 : (int) DIV_ROUND_UP(timeout, USEC_PER_MSEC)); if (m < 0) { -- cgit v1.2.1