This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug target/36525] New: prologue code may give invalid stack back chain


The SPU ABI states:
"The first word of the stack frame must always point to the previously
allocated stack frame (toward higher addresses), except for the first stack
frame, which must have a back chain pointer of 0 (NULL)."

SPU doesn't have a single instruction that can both write the back chain and
adjust the stack pointer, so keeping the above invariant in the presence of
interrupts is a little tricky.  For frames smaller than 2000 bytes,
spu_expand_prologue first writes the back chain word, then adjusts the stack. 
This is fine since we have a 2000 byte red zone.  For frames larger than 2000
bytes, the stack is decremented first, then the back chain word is written. 
This opens a small window where an interrupt can occur with an uninitialized
back chain.  If the interrupt handler walks stack frames for some reason, it
will see a broken frame.  Tools like oprofile are known to have such handlers.

A possible solution is to ensure that the back chain write and the stack adjust
insns are always in the same dispatch pair.


-- 
           Summary: prologue code may give invalid stack back chain
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amodra at bigpond dot net dot au
GCC target triplet: spu-elf


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


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