From: Joe Perches <joe@perches.com>
To: Zheng Yejian <zhengyejian1@huawei.com>,
rostedt@goodmis.org, mingo@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ftrace: Fix char print issue in print_ip_ins()
Date: Mon, 10 Oct 2022 19:35:38 -0700 [thread overview]
Message-ID: <0a9453d94419991aa38d64b7a446eeba1f9c5a80.camel@perches.com> (raw)
In-Reply-To: <20221010191524.1626867-1-zhengyejian1@huawei.com>
On Mon, 2022-10-10 at 19:15 +0000, Zheng Yejian wrote:
> 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
[]
> @@ -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)) {
Perhaps nicer would be to change the for loop below this from
for (i = 0; i < MCOUNT_INSN_SIZE; i++)
printk(KERN_CONT "%s%02x", i ? ":" : "", ins[i]);
to
pr_cont("%*phC", MCOUNT_INSN_SIZE, ins);
next prev parent reply other threads:[~2022-10-11 2:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 19:15 [PATCH] ftrace: Fix char print issue in print_ip_ins() Zheng Yejian
2022-10-11 2:35 ` Joe Perches [this message]
2022-10-11 11:22 ` Zheng Yejian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a9453d94419991aa38d64b7a446eeba1f9c5a80.camel@perches.com \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=zhengyejian1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).