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

On Sun, Jan 14, 2018 at 11:24:53PM -0800, Stefan O'Rear wrote:
> On Sun, Jan 14, 2018 at 10:47 PM, Alan Kao <nonerkao@...il.com> wrote:
> > +       /*
> > +        * For the dynamic ftrace to work, here we should reserve at least
> > +        * 8 bytes for a functional auipc-jalr pair. Pseudo inst nop may be
> > +        * interpreted as different length in different models, so we manually
> > +        * *expand* two 4-byte nops here.
> > +        *
> > +        * Calling ftrace_update_ftrace_func would overwrite the nops below.
> > +        * Check ftrace_modify_all_code for details.
> > +        */
> > +       addi    x0, x0, 0
> > +       addi    x0, x0, 0
> 
> This relies on behavior of the assembler which is undocumented and, if
> my reading of the specification is correct, a bug.
> 
> The documented way to assemble an sequence of 2 4-byte NOPs regardless
> of subtarget is as follows:
> 
> .option push
> .option norvc
>     nop
>     nop
> .option pop
> 
> I have filed https://github.com/riscv/riscv-binutils-gdb/issues/135 to
> get clarity on the assembler behavior; the explicit approach may be
> preferable even if the assembler behavior turns out to be correct.
> 
> -s
> 

Thanks for pointing this out.

After checking the way other architectures have done this, I think we can 
just put a 

	call ftrace_stub

here.  Currently we don't support linker relaxing with ftrace, so this
macro will be expand to 8-byte inst-pair.

Alan

> -- 
> You received this message because you are subscribed to the Google Groups "RISC-V Patches" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to patches+unsubscribe@...ups.riscv.org.
> To post to this group, send email to patches@...ups.riscv.org.
> Visit this group at https://groups.google.com/a/groups.riscv.org/group/patches/.
> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/patches/CADJ6UvOZz%3DWZ18wYVhZcH0u58u_snDxmgbwsfTOS2ski-4O7tg%40mail.gmail.com.
> For more options, visit https://groups.google.com/a/groups.riscv.org/d/optout.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ