| Summary: | invalid reads reported in libarmmem memcmp when using strings | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Bjorn <bjorn.vantilt> |
| Component: | memcheck | Assignee: | Paul Floyd <pjfloyd> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | bjorn.vantilt, pjfloyd |
| Priority: | NOR | ||
| Version First Reported In: | 3.13.0 | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Unspecified | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
Valgrind log
Patch for libarmmem |
||
|
Description
Bjorn
2018-09-13 09:17:10 UTC
This happens because the partial-loads-ok heuristic inside Memcheck only applies to word-sized loads on arm32, not to double-word-sized loads, as would be required here. It *might* be possible to make it do so since IIRC the mips32 port does support p-l-ok on 64 bit loads. Scratching my head a bit as I gave it a quick try and it didn't work - shouldn't there be redirs for these functions in shared/vg_replace_strmem.c paulf@raspberrypi:~/scratch/valgrind $ nm -D /usr/lib/arm-linux-gnueabihf/libarmmem-v8l.so 000004d0 T memcmp 00000b58 T memcpy 0000216c T memmove 000030e4 T __mempcpy 000030e4 T mempcpy 000030f8 T memset 000031c0 T strlen Well the libarmmem.so library has a NULL soname. At the moment I think that is causing the debuginfo detection to fail. --- Reading (ELF, standard) dynamic symbol table (14 entries) ---
raw symbol [ 1]: LOC SEC : svma 0x0000000374, sz 0 NONAME
raw symbol [ 2]: LOC SEC : svma 0x0000014024, sz 0 NONAME
raw symbol [ 3]: WEA FUN : svma 0x0000000000, sz 0 __cxa_finalize
ignore -- size=0: __cxa_finalize
raw symbol [ 4]: WEA NOT : svma 0x0000000000, sz 0 _ITM_deregisterTMCloneTable
raw symbol [ 5]: WEA NOT : svma 0x0000000000, sz 0 __gmon_start__
raw symbol [ 6]: WEA NOT : svma 0x0000000000, sz 0 _ITM_registerTMCloneTable
raw symbol [ 7]: GLO NOT : svma 0x00000030f8, sz 0 memset
raw symbol [ 8]: GLO NOT : svma 0x00000030e4, sz 0 mempcpy
raw symbol [ 9]: GLO NOT : svma 0x00000031c0, sz 0 strlen
raw symbol [ 10]: GLO NOT : svma 0x000000216c, sz 0 memmove
raw symbol [ 11]: GLO NOT : svma 0x00000030e4, sz 0 __mempcpy
raw symbol [ 12]: GLO NOT : svma 0x0000000b58, sz 0 memcpy
raw symbol [ 13]: GLO NOT : svma 0x00000004d0, sz 0 memcmp
------ Canonicalising the acquired info ------
------ Notifying m_redir ------
------ name = /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so
------ end ELF OBJECT -------------------------------------------------------
Explains it all. No type. No size.
I've added an issue to the raspbian bug tracker along with an initial patch https://bugs.launchpad.net/raspbian/+bug/2051392 Created attachment 165272 [details]
Patch for libarmmem
Patch to redirect mem/str functions in libarmmem
I've submitted a pull request here https://github.com/bavison/arm-mem/pull/12 And the pull request has been merged. |