lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 18 Jun 2024 12:13:56 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Puranjay Mohan <puranjay@...nel.org>
Cc: Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt
 <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, Samuel Holland
 <samuel.holland@...ive.com>, Matthew Bystrin <dev.mbstr@...il.com>,
 linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
 puranjay12@...il.com
Subject: Re: [PATCH] riscv: stacktrace: fix usage of ftrace_graph_ret_addr()

On Tue, 18 Jun 2024 14:58:20 +0000
Puranjay Mohan <puranjay@...nel.org> wrote:

> ftrace_graph_ret_addr() takes an `idx` integer pointer that is used to
> optimize the stack unwinding. Pass it a valid pointer to utilize the
> optimizations that might be available in the future.
> 
> The commit is making riscv's usage of ftrace_graph_ret_addr() match
> x86_64.
> 
> Signed-off-by: Puranjay Mohan <puranjay@...nel.org>

Not only that, the updated code for ftrace_graph_ret_addr() will just
return the passed in return address if it is NULL. Basically, it will
not work without this.

Reviewed-by: Steven Rostedt (Google) <rostedt@...dmis.org>

-- Steve


> ---
>  arch/riscv/kernel/stacktrace.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
> index 528ec7cc9a62..6cb7f9ca9d82 100644
> --- a/arch/riscv/kernel/stacktrace.c
> +++ b/arch/riscv/kernel/stacktrace.c
> @@ -32,6 +32,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
>  			     bool (*fn)(void *, unsigned long), void *arg)
>  {
>  	unsigned long fp, sp, pc;
> +	int graph_idx = 0;
>  	int level = 0;
>  
>  	if (regs) {
> @@ -68,7 +69,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
>  			pc = regs->ra;
>  		} else {
>  			fp = frame->fp;
> -			pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
> +			pc = ftrace_graph_ret_addr(current, &graph_idx, frame->ra,
>  						   &frame->ra);
>  			if (pc == (unsigned long)ret_from_exception) {
>  				if (unlikely(!__kernel_text_address(pc) || !fn(arg, pc)))


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ