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: <20171213005735.GB26787@1a3c108b4593>
Date:   Wed, 13 Dec 2017 08:57:39 +0800
From:   Alan Kao <nonerkao@...il.com>
To:     Palmer Dabbelt <palmer@...ive.com>
Cc:     Jim Wilson <jimw@...ive.com>, albert@...ive.com,
        rostedt@...dmis.org, mingo@...hat.com, patches@...ups.riscv.org,
        linux-kernel@...r.kernel.org, greentime@...estech.com,
        alankao@...estech.com, pombredanne@...b.com, kito@...estech.com
Subject: Re: [patches] [PATCH v2] riscv/ftrace: Add basic support

On Mon, Dec 11, 2017 at 10:15:58AM -0800, Palmer Dabbelt wrote:
> On Wed, 06 Dec 2017 18:31:10 PST (-0800), nonerkao@...il.com wrote:

Hi Palmer, 

I forgot to explain this section in the previous reply:

> > +ENTRY(_mcount)
> > +	la	t4, ftrace_stub
> > +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > +	la	t0, ftrace_graph_return
> > +	ld	t1, 0(t0)
> > +	bne	t1, t4, do_ftrace_graph_caller
> > +
> > +	la	t3, ftrace_graph_entry
> > +	ld	t2, 0(t3)
> > +	la	t6, ftrace_graph_entry_stub
> > +	bne	t2, t6, do_ftrace_graph_caller
> > +#endif
> > +	la	t3, ftrace_trace_function
> > +	ld	t5, 0(t3)
> > +	bne	t5, t4, do_trace
> > +	ret
> 
> * You can save an instruction when addressing by using somethingl like "ld
> t1,  ftrace_graph_return" instead of "la t0, ftrace_graph_return; ld t1
> 0(t0)".
> 

There are three "la-ld" instruction pairs for loading ftrace_graph_return,
ftrace_graph_entry, and ftrace_trace_function.  All of them are function
pointers in C.  The problem here is that, if we applied an "ld" inst. to a
function pointer, we would have loaded the content, which would be the 
first 8 bytes in the function, rather than the address of the target function
that the function pointer stored before.

In brief, the logic of the "la-ld" pairs should be fine.

Alan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ