• Ard Biesheuvel's avatar
    ARM: unwind: track location of LR value in stack frame · 538b9265
    Ard Biesheuvel authored
    The ftrace graph tracer needs to override the return address of an
    instrumented function, in order to install a hook that gets invoked when
    the function returns again.
    
    Currently, we only support this when building for ARM using GCC with
    frame pointers, as in this case, it is guaranteed that the function will
    reload LR from [FP, #-4] in all cases, and we can simply pass that
    address to the ftrace code.
    
    In order to support this for configurations that rely on the EABI
    unwinder, such as Thumb2 builds, make the unwinder keep track of the
    address from which LR was unwound, permitting ftrace to make use of this
    in a subsequent patch.
    
    Drop the call to is_kernel_text_address(), which is problematic in terms
    of ftrace recursion, given that it may be instrumented itself. The call
    is redundant anyway, as no unwind directives will be found unless the PC
    points to memory that is known to contain executable code.
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
    538b9265
unwind.c 14.2 KB