• Sami Tolvanen's avatar
    scs: Disable when function graph tracing is enabled · ddc9863e
    Sami Tolvanen authored
    The graph tracer hooks returns by modifying frame records on the
    (regular) stack, but with SCS the return address is taken from the
    shadow stack, and the value in the frame record has no effect. As we
    don't currently have a mechanism to determine the corresponding slot
    on the shadow stack (and to pass this through the ftrace
    infrastructure), for now let's disable SCS when the graph tracer is
    enabled.
    
    With SCS the return address is taken from the shadow stack and the
    value in the frame record has no effect. The mcount based graph tracer
    hooks returns by modifying frame records on the (regular) stack, and
    thus is not compatible. The patchable-function-entry graph tracer
    used for DYNAMIC_FTRACE_WITH_REGS modifies the LR before it is saved
    to the shadow stack, and is compatible.
    
    Modifying the mcount based graph tracer to work with SCS would require
    a mechanism to determine the corresponding slot on the shadow stack
    (and to pass this through the ftrace infrastructure), and we expect
    that everyone will eventually move to the patchable-function-entry
    based graph tracer anyway, so for now let's disable SCS when the
    mcount-based graph tracer is enabled.
    
    SCS and patchable-function-entry are both supported from LLVM 10.x.
    Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
    Reviewed-by: default avatarKees Cook <keescook@chromium.org>
    Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
    Signed-off-by: default avatarWill Deacon <will@kernel.org>
    ddc9863e
Kconfig 28.9 KB