diff mbox series

ftrace: Fix print_ip_ins() to print only two digits per byte

Message ID 20221209105640.6d5eda0e@gandalf.local.home (mailing list archive)
State Superseded
Headers show
Series ftrace: Fix print_ip_ins() to print only two digits per byte | expand

Commit Message

Steven Rostedt Dec. 9, 2022, 3:56 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Fix print_ip_ins() to use unsigned char, as:

	e9:2b:b6:0d:18

is easier to understand than

	ffffffe9:2b:ffffffb6:0d:18

Link: https://lore.kernel.org/all/CA+wXwBQ-VhK+hpBtYtyZP-NiX4g8fqRRWithFOHQW-0coQ3vLg@mail.gmail.com/

Cc: stable@vger.kernel.org
Fixes: 6c14133d2d3f7 ("ftrace: Do not blindly read the ip address in ftrace_bug()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zheng Yejian Dec. 10, 2022, 4:12 a.m. UTC | #1
On 2022/12/9 23:56, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> Fix print_ip_ins() to use unsigned char, as:
> 
> 	e9:2b:b6:0d:18
> 
> is easier to understand than
> 
> 	ffffffe9:2b:ffffffb6:0d:18
> 
> Link: https://lore.kernel.org/all/CA+wXwBQ-VhK+hpBtYtyZP-NiX4g8fqRRWithFOHQW-0coQ3vLg@mail.gmail.com/
> 
> Cc: stable@vger.kernel.org
> Fixes: 6c14133d2d3f7 ("ftrace: Do not blindly read the ip address in ftrace_bug()")
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>   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 d04552c0c275..32fc1600d596 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2028,7 +2028,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];
>   
>   	if (copy_from_kernel_nofault(ins, p, MCOUNT_INSN_SIZE)) {
>   		printk(KERN_CONT "%s[FAULT] %px\n", fmt, p);

Hi, Steve,

commit 30f7d1cac2aa ("ftrace: Fix char print issue in print_ip_ins()")
has solved this issue.

Link: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=30f7d1cac2aab8fec560a388ad31ca5e5d04a822
Steven Rostedt Dec. 10, 2022, 4:42 a.m. UTC | #2
On Sat, 10 Dec 2022 12:12:23 +0800
Zheng Yejian <zhengyejian1@huawei.com> wrote:

> Hi, Steve,
> 
> commit 30f7d1cac2aa ("ftrace: Fix char print issue in print_ip_ins()")
> has solved this issue.
> 
> Link: 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=30f7d1cac2aab8fec560a388ad31ca5e5d04a822

Ah, that's probably why I never applied it, and it was sitting in my
staging branch. I just noticed it with a couple of other commits, that were
not applied.

OK, I'll revert it. Thanks for letting me know.

-- Steve
diff mbox series

Patch

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index d04552c0c275..32fc1600d596 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2028,7 +2028,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];
 
 	if (copy_from_kernel_nofault(ins, p, MCOUNT_INSN_SIZE)) {
 		printk(KERN_CONT "%s[FAULT] %px\n", fmt, p);