https://bugs.kde.org/show_bug.cgi?id=422623
Bug ID: 422623 Summary: epoll_ctl triggers valgrind warnings on aarch64 Product: valgrind Version: unspecified Platform: Other URL: https://bugzilla.redhat.com/show_bug.cgi?id=1844778 OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: jsew...@acm.org Reporter: m...@klomp.org Target Milestone: --- We check the event param with: PRE_MEM_READ( "epoll_ctl(event)", ARG4, sizeof(struct vki_epoll_event) ); But struct vki_epoll_event is defined as: #ifdef __x86_64__ #define VKI_EPOLL_PACKED __attribute__((packed)) #else #define VKI_EPOLL_PACKED #endif struct vki_epoll_event { __vki_u32 events; __vki_u64 data; } VKI_EPOLL_PACKED; Which mimics the kernel headers and means it isn't packed on non-x86_64 arches and might contain padding on such architectures (as it does on arm64). This can be solved with something like the following: diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-l index f1ecbbf..e94c448 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1923,8 +1923,13 @@ PRE(sys_epoll_ctl) SARG1, ( ARG2<3 ? epoll_ctl_s[ARG2] : "?" ), SARG3, ARG4); PRE_REG_READ4(long, "epoll_ctl", int, epfd, int, op, int, fd, struct vki_epoll_event *, event); - if (ARG2 != VKI_EPOLL_CTL_DEL) - PRE_MEM_READ( "epoll_ctl(event)", ARG4, sizeof(struct vki_epoll_event) ); + if (ARG2 != VKI_EPOLL_CTL_DEL) { + struct vki_epoll_event *event = (struct vki_epoll_event *) ARG4; + PRE_MEM_READ( "epoll_ctl(event.events)", (Addr) &event->events, + sizeof(__vki_u32) ); + PRE_MEM_READ( "epoll_ctl(event.data)", (Addr) &event->data, + sizeof(__vki_u64) ); + } } PRE(sys_epoll_wait) But as pointed out in the Fedora bug report (https://bugzilla.redhat.com/show_bug.cgi?id=1844778) even that might not be completely correct since epoll_data_t is a union of both 32- and 64-bit fields and so might only have seen half of the 64-bits be defined. -- You are receiving this mail because: You are watching all bug changes.