This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, nios2, committed] Fix stdlib/tst-makecontext regression for Nios II


This patch fixes the backtrace infinite loop regression for the stdlib/tst-makecontext testcase
that happened for a number of targets, Nios II included. Most archs fixed this by a combination
of removing FDEs and/or launching the makecontext wrapped function from the trampoline,
but this one is slightly different.

Basically FDE lookup does not use exactly the return address, but rather (return_address - 1).
This causes the use of ra == &__start_context (beginning of function), to actually lookup the FDE
of the prior __setcontext instead. Since the CFIs in __setcontext has nothing to
alter/restore/undefine RA, it just keeps spinning at that FDE until the testcase backtrace
callback's counter is up, and asserts fail.

So this regression can be fixed by simply adding an NOP before __startcontext, which allows
the FDE lookup to just fail and return NULL there, and close the backtrace.

Tested and committed.

2016-04-25  Chung-Lin Tang  <cltang@codesourcery.com>

        * sysdeps/unix/sysv/linux/nios2/setcontext.S (__startcontext):
        Add nop before __startcontext, add explaining comments.

Attachment: g.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]