Bug 415621

Summary: epoll_ctl reports for uninitialized padding
Product: [Developer tools] valgrind Reporter: Simon Richter <Simon.Richter>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: normal CC: mark, zbyszek
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Simon Richter 2019-12-27 20:03:33 UTC
SUMMARY

On platforms where the epoll_event struct is padded (>= 64 bit architectures except amd64), the padding is reported uninitialized unless the program explicitly uses memset.

STEPS TO REPRODUCE
1. On powerpc64, compile and run

#include <sys/epoll.h>
int main(int, char **)
{
    epoll_event evt;
    evt.events = 0;
    evt.data.ptr = nullptr;
    epoll_ctl(0, EPOLL_CTL_ADD, 0, &evt);
}

OBSERVED RESULT

The padding is reported as uninitialized.

EXPECTED RESULT

No error, or an indication that this is mostly harmless.
Comment 1 Julian Seward 2019-12-28 19:27:28 UTC
Do you have a syscall wrapper patch that fixes this, by any chance?
Comment 2 Simon Richter 2019-12-28 19:44:21 UTC
Not yet, I'd need guidance on what would be the desired behaviour for uninitialized padding in the middle of a struct (which is harmless but might leak data if it is blindly copied around).

Is there a flag for hiding these warnings, or a separate reporting level?
Comment 3 Mark Wielaard 2020-07-05 21:45:08 UTC
I filed a similar bug which has a bit more information and a potential patch, marking this as a duplicate (sorry I missed it earlier).

*** This bug has been marked as a duplicate of bug 422623 ***