Message ID | 20191018161033.261971-10-samitolvanen@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | add support for Clang's Shadow Call Stack | expand |
On Fri, 18 Oct 2019 09:10:24 -0700 Sami Tolvanen <samitolvanen@google.com> wrote: > With CONFIG_FUNCTION_GRAPH_TRACER, function return addresses are > modified in ftrace_graph_caller and prepare_ftrace_return to redirect > control flow to ftrace_return_to_handler. This is incompatible with > return address protection. > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> > --- > kernel/trace/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig > index e08527f50d2a..b7e5e3bfa0f4 100644 > --- a/kernel/trace/Kconfig > +++ b/kernel/trace/Kconfig > @@ -161,6 +161,7 @@ config FUNCTION_GRAPH_TRACER > depends on HAVE_FUNCTION_GRAPH_TRACER > depends on FUNCTION_TRACER > depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE > + depends on ROP_PROTECTION_NONE NAK, Put this in the arch code. > default y > help > Enable the kernel to trace a function at both its return -- Steve diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 41a9b4257b72..d68339987604 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -149,7 +149,7 @@ config ARM64 select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_ERROR_INJECTION - select HAVE_FUNCTION_GRAPH_TRACER + select HAVE_FUNCTION_GRAPH_TRACER if ROP_PROTECTION_NONE select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS select HAVE_IRQ_TIME_ACCOUNTING
On Fri, Oct 18, 2019 at 10:01 AM Steven Rostedt <rostedt@goodmis.org> wrote: > NAK, Put this in the arch code. > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 41a9b4257b72..d68339987604 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -149,7 +149,7 @@ config ARM64 > select HAVE_FTRACE_MCOUNT_RECORD > select HAVE_FUNCTION_TRACER > select HAVE_FUNCTION_ERROR_INJECTION > - select HAVE_FUNCTION_GRAPH_TRACER > + select HAVE_FUNCTION_GRAPH_TRACER if ROP_PROTECTION_NONE > select HAVE_GCC_PLUGINS > select HAVE_HW_BREAKPOINT if PERF_EVENTS > select HAVE_IRQ_TIME_ACCOUNTING Thanks, Steven. I'll fix this and kretprobes in v2. Sami
On Fri, 18 Oct 2019 at 18:11, Sami Tolvanen <samitolvanen@google.com> wrote: > > With CONFIG_FUNCTION_GRAPH_TRACER, function return addresses are > modified in ftrace_graph_caller and prepare_ftrace_return to redirect > control flow to ftrace_return_to_handler. This is incompatible with > return address protection. > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> How difficult would it be to update the return address on the shadow call stack along with the normal one? Not having to disable infrastructure that is widely used by the distros would make this a lot more palatable in the general case (even if it is Clang only at the moment) > --- > kernel/trace/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig > index e08527f50d2a..b7e5e3bfa0f4 100644 > --- a/kernel/trace/Kconfig > +++ b/kernel/trace/Kconfig > @@ -161,6 +161,7 @@ config FUNCTION_GRAPH_TRACER > depends on HAVE_FUNCTION_GRAPH_TRACER > depends on FUNCTION_TRACER > depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE > + depends on ROP_PROTECTION_NONE > default y > help > Enable the kernel to trace a function at both its return > -- > 2.23.0.866.gb869b98d4c-goog >
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index e08527f50d2a..b7e5e3bfa0f4 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -161,6 +161,7 @@ config FUNCTION_GRAPH_TRACER depends on HAVE_FUNCTION_GRAPH_TRACER depends on FUNCTION_TRACER depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE + depends on ROP_PROTECTION_NONE default y help Enable the kernel to trace a function at both its return
With CONFIG_FUNCTION_GRAPH_TRACER, function return addresses are modified in ftrace_graph_caller and prepare_ftrace_return to redirect control flow to ftrace_return_to_handler. This is incompatible with return address protection. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> --- kernel/trace/Kconfig | 1 + 1 file changed, 1 insertion(+)