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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 May 2019 23:06:39 +0800
From:   l00383200 <liucheng32@...wei.com>
To:     <rmk+kernel@....linux.org.uk>, <tglx@...utronix.de>
CC:     <peterz@...radead.org>, <gregkh@...uxfoundation.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <liucheng32@...wei.com>
Subject: [PATCH] Stacktrace in ARM32 architecture has jumped the first 2 layers, which may ignore the display of save_stack_trace_tsk.

Without optimization, both save_stack_trace_tsk and __save_stack_trace
will have stacktrace information in ARM32.

In this situation, "data.skip += 2" operation will skip the first two layers,
which may make the stacktrace strange and different from other architectures.

A simple example is as follows:
In ARM32 architecture:
[<ffffff80083cb3f8>] proc_pid_stack+0xac/0x12c
[<ffffff80083c7c70>] proc_single_show+0x5c/0xa8
[<ffffff800838aca8>] seq_read+0x130/0x420
[<ffffff8008365c54>] __vfs_read+0x60/0x11c
[<ffffff80083665dc>] vfs_read+0x8c/0x140
[<ffffff800836717c>] SyS_read+0x6c/0xcc
[<ffffff8008202cb8>] __sys_trace_return+0x0/0x4
[<ffffffffffffffff>] 0xffffffffffffffff

In some other architectures(ARM64):
[<ffffff8008209be0>] save_stack_trace_tsk+0x0/0xf0
[<ffffff80083cb3f8>] proc_pid_stack+0xac/0x12c
[<ffffff80083c7c70>] proc_single_show+0x5c/0xa8
[<ffffff800838aca8>] seq_read+0x130/0x420
[<ffffff8008365c54>] __vfs_read+0x60/0x11c
[<ffffff80083665dc>] vfs_read+0x8c/0x140
[<ffffff800836717c>] SyS_read+0x6c/0xcc
[<ffffff8008202cb8>] __sys_trace_return+0x0/0x4
[<ffffffffffffffff>] 0xffffffffffffffff

Therefore, we'd better just jump only one layer to ensure accuracy and consistency.

Signed-off-by: liucheng <liucheng32@...wei.com>
---
 arch/arm/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 71778bb..bb3da38 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -125,7 +125,7 @@ static noinline void __save_stack_trace(struct task_struct *tsk,
 #endif
 	} else {
 		/* We don't want this function nor the caller */
-		data.skip += 2;
+		data.skip += 1;
 		frame.fp = (unsigned long)__builtin_frame_address(0);
 		frame.sp = current_stack_pointer;
 		frame.lr = (unsigned long)__builtin_return_address(0);
-- 
1.8.5.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ