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:	Tue, 7 Jul 2015 17:35:19 -0500
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>
Cc:	Michal Marek <mmarek@...e.cz>,
	Peter Zijlstra <peterz@...radead.org>,
	Andy Lutomirski <luto@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	Pedro Alves <palves@...hat.com>, x86@...nel.org,
	live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
	Martin Jambor <mjambor@...e.cz>, Jiri Kosina <jkosina@...e.cz>,
	Segher Boessenkool <segher@...nel.crashing.org>
Subject: Re: [PATCH v6 0/4] Compile-time stack validation

On Tue, Jul 07, 2015 at 09:54:09AM -0500, Josh Poimboeuf wrote:
>    I did some more looking and it turns out that inline assembly doesn't
>    play nicely with frame pointers at all.  If the inline asm is at the
>    beginning of the function, gcc sometimes emits the inline asm code
>    before setting up the frame pointer.  That can break stack traces
>    when the inline asm has a call instruction.
> 
>    That turns out to be a very common problem.  Stackvalidate found 37 C
>    object files which break frame pointer rules, thanks to inline asm.
> 
>    I don't know of a solution to this problem yet.  Basically I think we
>    need a way to ensure that gcc emits the frame pointer setup before
>    inserting any inline asm (particularly when the inline asm has a call
>    instruction).

A solution to this problem was posted by Segher Boessenkool in a related
thread on the gcc mailing list:

  https://gcc.gnu.org/ml/gcc/2015-07/msg00080.html

The suggestion is to use something like:
  
	register void *sp asm("%sp");
	asm volatile("call func" : "+r"(sp));

I can confirm that it seems to fix the issue.  (I had tried something
like this before, but I guess I wasn't able to get the incantation just
right.)

Thanks to Jiri for the pointer to the thread, and Martin for raising the
issue on the gcc list.

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