lkml.org 
[lkml]   [2022]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ftrace: Fix char print issue in print_ip_ins()
Date
When ftrace bug happened, following log shows every byte data in
problem ip address:
actual: ffffffe8:6b:ffffffd9:01:21

However that seems a little confusing, and it is because format
'%x' being used to print signed chars in print_ip_ins().

After this patch, the log is like:
actual: e8:6b:d9:01:21

Fixes: 6c14133d2d3f ("ftrace: Do not blindly read the ip address in ftrace_bug()")
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
---
kernel/trace/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 439e2ab6905e..251ba30c871d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2015,7 +2015,7 @@ static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops,

static void print_ip_ins(const char *fmt, const unsigned char *p)
{
- char ins[MCOUNT_INSN_SIZE];
+ unsigned char ins[MCOUNT_INSN_SIZE];
int i;

if (copy_from_kernel_nofault(ins, p, MCOUNT_INSN_SIZE)) {
--
2.25.1
\
 
 \ /
  Last update: 2022-10-10 13:17    [W:0.047 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site