| Summary: | socket connect produce false positive saying access to uninitialized memory area | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | hdun <hdbuffer> |
| Component: | memcheck | Assignee: | Julian Seward <jseward> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | philippe.waroquiers |
| Priority: | NOR | ||
| Version First Reported In: | 3.10.0 | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Fix Committed revision 14835. Thanks for the analysis and fix suggestion |
We add a new type of socket in Linux with a new address type sa->sa_family not listed in function pre_mem_read_sockaddr. When the socket connecting, memcheck tool produce false positive saying access uninitialized memory area. I check the code and find the salen in pre_mem_read_sockaddr function should be "salen - sizeof(sa->sa_family)" The salen is the total addr struct size, while the addr->sa_data length should be salen - sizeof(sa->sa_family) static void pre_mem_read_sockaddr ( ThreadId tid, const HChar *description, struct vki_sockaddr *sa, UInt salen ) { ... default: VG_(sprintf) ( outmsg, description, "sa_data" ); PRE_MEM_READ( outmsg, (Addr)&sa->sa_family + sizeof(sa->sa_family), salen ); /* salen should be salen-sizeof(sa->sa_family)*/ break; } ... } Reproducible: Always Steps to Reproduce: 1.connect with a new type of socket addr 2. 3. Actual Results: false positive saying access to uninitialized memory area