Thread (11 messages) 11 messages, 4 authors, 2024-12-11

Re: [PATCH v2 1/2] ftrace: Make ftrace_regs abstract from direct use

From: Heiko Carstens <hca@linux.ibm.com>
Date: 2024-10-09 09:37:37
Also in: linux-arch, linux-arm-kernel, linux-riscv, linux-s390, linux-trace-kernel, lkml, loongarch

On Tue, Oct 08, 2024 at 07:05:28PM -0400, Steven Rostedt wrote:
From: Steven Rostedt <rostedt@goodmis.org>

ftrace_regs was created to hold registers that store information to save
function parameters, return value and stack. Since it is a subset of
pt_regs, it should only be used by its accessor functions. But because
pt_regs can easily be taken from ftrace_regs (on most archs), it is
tempting to use it directly. But when running on other architectures, it
may fail to build or worse, build but crash the kernel!

Instead, make struct ftrace_regs an empty structure and have the
architectures define __arch_ftrace_regs and all the accessor functions
will typecast to it to get to the actual fields. This will help avoid
usage of ftrace_regs directly.

Link: https://lore.kernel.org/all/20241007171027.629bdafd@gandalf.local.home/ (local)

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
...
 arch/s390/include/asm/ftrace.h           | 23 ++++++++++---------
 arch/s390/kernel/asm-offsets.c           |  4 ++--
 arch/s390/kernel/ftrace.c                |  2 +-
 arch/s390/lib/test_unwind.c              |  4 ++--
Acked-by: Heiko Carstens <hca@linux.ibm.com> # s390
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help