#
199b3b12 |
| 25-Sep-2019 |
Lei YU <mine260309@gmail.com> |
Add valgrind suppression
On latest OpenBMC, sdbusplus CI fails due to valgrind check like below on ppc64le systems:
==5290== Syscall param epoll_ctl(event) points to uninitialised byte(s) =
Add valgrind suppression
On latest OpenBMC, sdbusplus CI fails due to valgrind check like below on ppc64le systems:
==5290== Syscall param epoll_ctl(event) points to uninitialised byte(s) ==5290== at 0x4F2FB08: epoll_ctl (syscall-template.S:79) ==5290== by 0x493A8F7: UnknownInlinedFun (sd-event.c:961) ==5290== by 0x493A8F7: sd_event_add_time (sd-event.c:1019) ==5290== by 0x190BB3: phosphor::Timer::Timer(sd_event*, std::function<void ()>) (timer.hpp:62) ==5290== by 0x192B93: TimerTest::TimerTest() (timer.cpp:25) ==5290== by 0x193A13: TimerTest_timerExpiresAfter2seconds_Test::TimerTest_timerExpiresAfter2seconds_Test() (timer.cpp:85) ==5290== by 0x19E11F: testing::internal::TestFactoryImpl<TimerTest_timerExpiresAfter2seconds_Test>::CreateTest() (gtest-internal.h:472) ==5290== by 0x4A52D3B: HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*> (gtest.cc:2447) ==5290== by 0x4A52D3B: testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test * (testing::internal::TestFactoryBase::*)(), char const*) (gtest.cc:2483) ==5290== by 0x4A40BCB: Run (gtest.cc:2693) ==5290== by 0x4A40BCB: testing::TestInfo::Run() (gtest.cc:2676) ==5290== by 0x4A40DC3: Run (gtest.cc:2825) ==5290== by 0x4A40DC3: testing::TestCase::Run() (gtest.cc:2810) ==5290== by 0x4A414AF: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216) ==5290== by 0x4A5329B: HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (gtest.cc:2447) ==5290== by 0x4A5329B: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl:: *)(), char const*) (gtest.cc:2483) ==5290== by 0x4A416AF: testing::UnitTest::Run() (gtest.cc:4824) ==5290== by 0x4A90917: RUN_ALL_TESTS (gtest.h:2370) ==5290== by 0x4A90917: main (gmock_main.cc:69) ==5290== Address 0x1fff00eafc is on thread 1's stack ==5290== in frame #0, created by epoll_ctl (syscall-template.S:78) ==5290==
The root cause is: 1. GCC has a bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77992, that the padding bytes are not initialized. 2. In systemd, the code in [libsystemd/sd-event/sd-event.c][1] using epoll_event hit the above bug:
typedef union epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } epoll_data_t;
struct epoll_event { uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */ } __EPOLL_PACKED;
In glibc, on x86, `__EPOLL_PACKED` is defined as `__attribute__ ((__packed__))`[2], so it's packed and there are no internal padding bytes; On other architectures (e.g. ppc64le), __EPOLL_PACKED is not defined and thus there are 4 internal padding bytes between `events` and `data`, that are not initialized. 3. When epoll_ctl() is invoked, in [Linux kernel][3], it does a copy_from_user() to copy the whole struct into kernel space. That's why Valgrind reports "epoll_ctl(event) points to uninitialised byte(s)", only for non-x86 platforms. 4. The timer test in this repo invokes sd_event_add_time() and eventually hit the above code.
The GCC bug is not resolved from 2016. The systemd code is actually correct. There is a [PR][4] sent to systemd trying to workaround the issue, and it is being discussed.
Before GCC bug is resolved or systemd PR is accepted, suppress the valgrind error to make it pass the CI.
[1]: https://github.com/systemd/systemd/blob/v242/src/libsystemd/sd-event/sd-event.c#L961 [2]: https://github.com/bminor/glibc/blob/f1a0eb5b6762b315517469da47735c51bde6f4ad/sysdeps/unix/sysv/linux/x86/bits/epoll.h#L29 [3]: https://github.com/torvalds/linux/blob/d1eef1c619749b2a57e514a3fa67d9a516ffa919/fs/eventpoll.c#L2095 [4]: https://github.com/systemd/systemd/pull/14353
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I3a29fd0e28e5c7b69037a7ef2ef9571f93d80df7
show more ...
|