[Bug gdb/34367] GDB internal inferior malloc lookup may call GNU IFUNC resolver directly

wdijkstr at arm dot com via Gdb-prs <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34367

Wilco <wdijkstr at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wdijkstr at arm dot com

--- Comment #1 from Wilco <wdijkstr at arm dot com> ---
There is another issue of why malloc is used at all - this interferes with the
application state, adds a leak and may result in memory issues not being
reproducible in GDB.

For string literals needed for expression evaluation it's best to place them on
the stack. Generally functions don't assume global lifetimes of pointer
arguments passed. If a longer lifetime is needed, it is best to create an mmap
region well outside existing mmap/sbrk regions (otherwise it will still
interfere with application state...).

Note it is also unsafe to directly call ifunc resolvers - the existing
implementation only passes HWCAP which is not sufficient on targets that have
HWCAP2/3/4 and specific ABIs for resolvers. As a result it may fail or return
the wrong ifunc. In the future GLIBC will likely disallow direct calls to its
internal resolvers and give a fatal error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
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.