• Nicolas Pitre's avatar
    ARM: signal handling support for FDPIC_FUNCPTRS functions · 5c165953
    Nicolas Pitre authored
    Signal handlers are not direct function pointers but pointers to function
    descriptor in that case. Therefore we must retrieve the actual function
    address and load the GOT value into r9 from the descriptor before branching
    to the actual handler.
    
    If a restorer is provided, we also have to load its address and GOT from
    its descriptor. That descriptor address and the code to load it is pushed
    onto the stack to be executed as soon as the signal handler returns.
    
    However, to be compatible with NX stacks, the FDPIC bounce code is also
    copied to the signal page along with the other code stubs. Therefore this
    code must get at the descriptor address whether it executes from the stack
    or the signal page. To do so we use the stack pointer which points at the
    signal stack frame where the descriptor address was stored. Because the
    rt signal frame is different from the simpler frame, two versions of the
    bounce code are needed, and two variants (ARM and Thumb) as well. The
    asm-offsets facility is used to determine the actual offset in the signal
    frame for each version, meaning that struct sigframe and rt_sigframe had
    to be moved to a separate file.
    Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
    Acked-by: default avatarMickael GUENE <mickael.guene@st.com>
    Tested-by: default avatarVincent Abriou <vincent.abriou@st.com>
    Tested-by: default avatarAndras Szemzo <szemzo.andras@gmail.com>
    5c165953
ucontext.h 2.94 KB