Re: [PATCH 0/1] Revert "malloc: aarch64: Add ifuncs for malloc functions"

Wilco Dijkstra <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <PAWPR08MB89825E29C0D98E70C0D6C2D983F42@PAWPR08MB8982.eurprd08.prod.outlook.com>
Hi HJ,

> I have been calling IFUNC functions, like strcmp, in GDB for a long time.
> There is no issue, other than GDB can't figure out its return type.  I
> have to cast the return value to int:
>
> (gdb) cond 1 (int) strcmp (name, "foo") == 0

There are several bugs here:

This calls the strcmp ifunc resolver if there is one. It can go wrong on targets
that have HWCAP2/3/4 since it only passes HWCAP. Doing this via the GOT or
dlsym() would get the correct address whether it is an ifunc or overridden.

It also calls malloc - that's the part that goes wrong if it is an ifunc. There is a
simple fix posted.

Another issue is whether GDB should ever call malloc (and creating a leak), thus
affecting the state of the application, making it harder to debug memory issues.

Cheers,
Wilco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.