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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 12 Jun 2020 15:41:46 +0800
From:   Wang Qing <wangqing@...o.com>
To:     Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        James Morse <james.morse@....com>,
        Mark Rutland <mark.rutland@....com>,
        Dave Martin <Dave.Martin@....com>,
        Dmitry Safonov <0x7f454c46@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Wang Qing <wangqing@...o.com>,
        jinho lim <jordan.lim@...sung.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:     opensource.kernel@...o.com
Subject: [PATCH] arm64: smp call when task currently running on other cpu

We cannot get FP and PC when the task is running on another CPU,
task->thread.cpu_context is the last time the task was switched out,
we can use smp call to print backtrace itself.

Signed-off-by: Wang Qing <wangqing@...o.com>
---
 arch/arm64/kernel/traps.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
 mode change 100644 => 100755 arch/arm64/kernel/traps.c

diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 50cc30a..17a07b9
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -83,6 +83,11 @@ static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
 	printk("%sCode: %s\n", lvl, str);
 }
 
+static void dump_backtrace_smp_fun(struct task_struct *tsk)
+{
+	dump_backtrace(NULL, tsk, KERN_DEFAULT);
+}
+
 void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
 		    const char *loglvl)
 {
@@ -107,6 +112,12 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
 		start_backtrace(&frame,
 				(unsigned long)__builtin_frame_address(0),
 				(unsigned long)dump_backtrace);
+	} else if (task_curr(tsk)) {
+		/*
+		 * The task is currently running on other cpu
+		 */
+		smp_call_function_single(tsk->cpu, dump_backtrace_fun, tsk, 0);
+		return;
 	} else {
 		/*
 		 * task blocked in __switch_to
-- 
2.7.4

Powered by blists - more mailing lists