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]
Date:   Thu, 11 Jan 2018 16:02:57 +0800
From:   Alan Kao <nonerkao@...il.com>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Palmer Dabbelt <palmer@...ive.com>, Albert Ou <albert@...ive.com>,
        Ingo Molnar <mingo@...hat.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Kamil Rytarowski <n54@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        patches@...ups.riscv.org, linux-kernel@...r.kernel.org,
        Alan Kao <alankao@...estech.com>,
        Greentime Hu <greentime@...estech.com>
Subject: Re: [PATCH 2/6] riscv/ftrace: Add dynamic function tracer support

On Wed, Jan 10, 2018 at 11:36:43AM -0500, Steven Rostedt wrote:
> On Wed, 10 Jan 2018 15:38:10 +0800
> Alan Kao <nonerkao@...il.com> wrote:
> 
> > +static int __ftrace_modify_call(unsigned long hook_pos, unsigned long target,
> > +				bool enable)
> > +{
> > +	unsigned int offset = (unsigned int)(target - hook_pos);
> > +	unsigned int auipc_call = to_auipc_insn(offset);
> > +	unsigned int jalr_call = to_jalr_insn(offset);
> > +	unsigned int calls[2] = {auipc_call, jalr_call};
> > +	unsigned int nops[2] = {NOP4, NOP4};
> > +	int ret = 0;
> > +
> > +	/* when ftrace_make_nop is called */
> > +	if (!enable)
> > +		ret = ftrace_check_current_call(hook_pos, calls);
> > +
> > +	if (ret)
> > +		goto out;
> > +
> > +	/* replace the auipc-jalr pair at once */
> > +	ret = probe_kernel_write((void *)hook_pos, enable ? calls : nops,
> > +				 MCOUNT_INSN_SIZE);
> > +	if (ret)
> 
> You don't want to return the return of probe_kernel_write() here. For
> ftrace bug to work properly, if a fail to write occurs, you need to
> return -EPERM.
> 
> -- Steve
> 
Thanks for the correction and the style fix in the previous mail.
These problems will be fixed in the next version patch.

Alan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ