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] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 24 Nov 2014 17:34:04 -0800
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Subject: Re: [RFC][PATCH 0/7] ftrace/x86: Clean up of mcount.S code

On Mon, Nov 24, 2014 at 4:42 PM, Steven Rostedt <rostedt@...dmis.org> wrote:
>
> Let me know if these changes have mcount.S give you less heebie-jeebies.

So I haven't looked at the individual patches, I just looked at the
rolled-up final patch in this email.

And yes, from that final patch, I certainly like this much more. At
least it now creates the frame in the obvious place, and the comments
explain the layout.

However, explain this (in the ftrace_caller_setup macro):

 #ifdef CC_USING_FENTRY
-       movq SS+16(%rsp), %rsi
+       movq MCOUNT_REG_SIZE+8+\added(%rsp), %rsi
 #else
-       movq 8(%rbp), %rsi
+       /* Need to grab the original %rbp */
+       movq RBP(%rsp), %rsi
+       /* Now parent address is 8 above original %rbp */
+       movq 8(%rsi), %rsi
 #endif

Why isn't that "follow rbp" approach now *always* the right thing to
do, regardless of fentry-vs-not? And in particular, couldn't you have
made '%rsi' already contain that old rbp address in save_mcount_regs,
the same way %rdi contains the RIP value?

(Yes, you can only do that after you've saved the old %rsi, but that's
easy enough to do by just delaying the second

    mov %rsp,%rbp

until after the save area, and replacing it with

    mov %rbp,%rsi
    lea MCOUNT_REG_SIZE - MCOUNT_FRAME_SIZE(%rsp),%rbp

after the saving of the frame. And now you have that RBP(%rsp) in %rsi
already, so regardless of whether you have CC_USING_FENTRY or not, the
above code becomes just

    /* Now parent address is 8 above original %rbp */
    movq 8(%rsi), %rsi

No?

Ok, so I didn't write it all out, and maybe I made some mistake while
writing this email. but it *looks* like your ftrace_caller_setup macro
is just unnecessarily complicated, and again, it's because you have
two different macros and they aren't taking advantage of each other
very well.

Hmm?

                 Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ