lkml.org 
[lkml]   [2020]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH v13 04/12] scs: disable when function graph tracing is enabled
    From
    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: Sami Tolvanen <samitolvanen@google.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Mark Rutland <mark.rutland@arm.com>
    ---
    arch/Kconfig | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/arch/Kconfig b/arch/Kconfig
    index 334a3d9b19df..45dfca9a98d3 100644
    --- a/arch/Kconfig
    +++ b/arch/Kconfig
    @@ -543,6 +543,7 @@ config ARCH_SUPPORTS_SHADOW_CALL_STACK
    config SHADOW_CALL_STACK
    bool "Clang Shadow Call Stack"
    depends on CC_IS_CLANG && ARCH_SUPPORTS_SHADOW_CALL_STACK
    + depends on DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER
    help
    This option enables Clang's Shadow Call Stack, which uses a
    shadow stack to protect function return addresses from being
    --
    2.26.2.303.gf8c07b1a785-goog
    \
     
     \ /
      Last update: 2020-04-27 18:00    [W:2.096 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site