public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/55431] New: Invalid auxv search in ppc linux-unwind code.
@ 2012-11-21 17:42 bugdal at aerifal dot cx
  2012-12-09  0:59 ` [Bug target/55431] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bugdal at aerifal dot cx @ 2012-11-21 17:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55431

             Bug #: 55431
           Summary: Invalid auxv search in ppc linux-unwind code.
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bugdal@aerifal.cx


config/rs6000/linux-unwind.h contains a function ppc_linux_aux_vector which
searches for the aux vector based on __libc_stack_end; the only use of this
function is to lookup the AT_HWCAP bitfield provided by the kernel. The results
seem to be used only for premature optimization: optimizing out copying
register sets that aren't used on the current cpu model.

Unfortunately, the method used to search for auxv is invalid at the time the
call to ppc_linux_aux_vector is made. The array pointed to by extern char
**environ; may be modified by the application; for example it may be truncated
to clear the environment by writing *environ = 0; In this case, the old,
no-longer-used part of the environ array will be incorrectly interpreted as the
aux vector, causing the unwind code not to find the hwcap values and thus not
to save the register sets it needs to save.

I found this bug while debugging a report that gcc couldn't be built for
powerpc on musl libc due to missing __libc_stack_end symbol. I don't see
anywhere that it's documented that __libc_stack_end points to the original argc
slot passed from the kernel, rather than some arbitrary address between main's
stack frame and argv[], so I think it's very bad design to be relying on this
implementation-detail anyway. The fix I would like to see is the complete
removal of ppc_linux_aux_vector and updating ppc_fallback_frame_state not to
care which register sets are actually in use.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-02-15 13:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 17:42 [Bug target/55431] New: Invalid auxv search in ppc linux-unwind code bugdal at aerifal dot cx
2012-12-09  0:59 ` [Bug target/55431] " pinskia at gcc dot gnu.org
2012-12-09  2:37 ` bugdal at aerifal dot cx
2013-02-11  9:12 ` aldot at gcc dot gnu.org
2013-02-11 18:17 ` dje at gcc dot gnu.org
2013-02-11 22:42 ` amodra at gmail dot com
2013-02-12  3:05 ` amodra at gmail dot com
2013-02-12  7:08 ` bugdal at aerifal dot cx
2013-02-12 13:24 ` amodra at gmail dot com
2013-02-12 15:28 ` bugdal at aerifal dot cx
2013-02-15 13:54 ` amodra at gcc dot gnu.org
2013-02-15 13:55 ` amodra at gmail dot com
2013-02-15 13:56 ` amodra at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).