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]
Message-ID: <20111216120001.GA27801@elte.hu>
Date:	Fri, 16 Dec 2011 13:00:01 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Jan Beulich <JBeulich@...e.com>
Cc:	Jeremy Fitzhardinge <jeremy@...p.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Alexander van Heukelum <heukelum@...tmail.fm>,
	fweisbec@...il.com, Arjan van de Ven <arjan@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	linux-kernel@...r.kernel.org, "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] x86: Use -m-omit-leaf-frame-pointer to shrink text size


* Jan Beulich <JBeulich@...e.com> wrote:

> >>> On 16.12.11 at 10:23, Jeremy Fitzhardinge <jeremy@...p.org> wrote:
> > On 12/16/2011 12:53 AM, Ingo Molnar wrote:
> >> * Ingo Molnar <mingo@...e.hu> wrote:
> >>
> >>> [...]
> >>>
> >>> The call-chains are still intact for quality backtraces 
> >>> and for call-chain profiling (perf record -g), as the 
> >>> backtrace walker can deduct the full backtrace from the 
> >>> RIP of a leaf function and the parent chain.
> 
> Are you sure about that even if the leaf function uses rBP for 
> a different purpose?

Well, i assumed that GCC does not mess with %bp in leaf 
functions - a frame pointer is barely useful if it's destroyed 
spuriously in leaf functions.

A quick grep of the assembly appears to support that assumption:

 $ objdump -d vmlinux | grep ',%rbp$' | cut -d: -f2- | sort | uniq -c | sort -n | tail -10

      3 	48 89 d5             	mov    %rdx,%rbp
      3 	4c 89 cd             	mov    %r9,%rbp
      4 	48 0f 45 e8          	cmovne %rax,%rbp
      4 	48 83 cd ff          	or     $0xffffffffffffffff,%rbp
      5 	4c 89 dd             	mov    %r11,%rbp
      7 	48 21 fd             	and    %rdi,%rbp
     10 	48 d3 e5             	shl    %cl,%rbp
     14 	48 85 ed             	test   %rbp,%rbp
     14 	48 8b 6c 24 20       	mov    0x20(%rsp),%rbp
  31042 	48 89 e5             	mov    %rsp,%rbp

%rbp is not touched, except in a few special assembly glue/entry 
pieces of code.

> >> Hm, noticed one complication while looking at annotated 
> >> assembly code in perf top. Code doing function calls from 
> >> within asm() is incorrectly marked 'leaf' by GCC:
> >>
> >> ffffffff812b82d8 <arch_local_save_flags>:
> >> ffffffff812b82d8:       ff 14 25 00 d9 c1 81    callq  *0xffffffff81c1d900
> >> ffffffff812b82df:       c3                      retq   
> >>
> >> So all the paravirt details will have to be fixed, so that 
> >> GCC is able to see that there's a real function call done 
> >> inside. Jeremy, Konrad?
> 
> If the above is not a problem, wouldn't this simply result in 
> a skipped function layer?

Yeah - i guess we can live with that, as long as the frame 
pointer chain is otherwise usable and walkable.

Thanks,

	Ingo
--
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