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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221011112232.1859993-1-zhengyejian1@huawei.com>
Date:   Tue, 11 Oct 2022 11:22:32 +0000
From:   Zheng Yejian <zhengyejian1@...wei.com>
To:     <joe@...ches.com>
CC:     <linux-kernel@...r.kernel.org>, <mingo@...hat.com>,
        <rostedt@...dmis.org>, <zhengyejian1@...wei.com>
Subject: Re: [PATCH] ftrace: Fix char print issue in print_ip_ins()

On Mon, 10 Oct 2022 19:35:38 -0700, Joe Perches <joe@...ches.com> wrote:
> 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@...wei.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);

It works, thanks for your suggestion. I'll send a new version patch.

-- Zheng Yejian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ