https://bugs.kde.org/show_bug.cgi?id=522497
Bug ID: 522497
Summary: If malloc is implemented as an ifunc Valgrind uses
resolver function as malloc
Classification: Developer tools
Product: valgrind
Version First 3.24.0
Reported In:
Platform: Debian stable
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
DESCRIPTION
A change introduced recently to Glibc [1] implements malloc family of functions
as ifuncs. Although Valgrind seems to be working with this version of Glibc,
further analysis shows that Valgrind would not resolve malloc ifunc and will
use the resolver as the malloc function itself. In this Glibc change, symbol
"malloc" points to an ifunc resolver. Normally, a complying dynamic loader will
obtain address of the implementation and will use this implementation for all
malloc calls.
STEPS TO REPRODUCE
1. Check out Glibc at commit 84c3993f1f from the master branch.
2. Apply patch [2].
3. Build Glibc.
4. Build a simple hello world program linked to this Glibc.
5. Run this program using Valgrind.
OBSERVED RESULT
Program crashes with message "ifunc resolver: incorrect argument: <value>".
EXPECTED RESULT
Program exits normally.
The value reported in the error message is not AT_HWCAP (see [3]) and appears
to be size of allocation (~76MB). This shows that ifunc resolver is called as
malloc function itself which is not correct. Valgrind should resolve ifuncs
before using the address of corresponding functions.
ADDITIONAL INFORMATION
Similar bug in GDB: [4].
[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=9ed3576e61
[2]:
https://inbox.sourceware.org/libc-alpha/[email protected]/
[3]: https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst
[4]: https://sourceware.org/bugzilla/show_bug.cgi?id=34330
--
You are receiving this mail because:
You are watching all bug changes.