Re: [PATCH] Revert "x86/uaccess: Add stack frame output operand in get_user() inline asm"

From: Michael Davidson
Date: Thu Jul 13 2017 - 15:38:38 EST

On Thu, Jul 13, 2017 at 12:25 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:

> Anyway this seems like a clang bug to me. If I specify RSP as an input
> register then the compiler shouldn't overwrite it first. For that
> matter it has no reason to overwrite it if it's an output register
> either.

It's certainly a difference in behavior between clang and gcc.

My question is whether this particular construct is really a
"supported" (or, at least, reasonably guaranteed) way of forcing gcc
to create a stack frame if none exists. or whether it is something
that "just happens to work".

If someone could explain the rationale behind *why* this works the way
that it does on gcc that might help convince the clang people that
this is actually a bug rather than just a piece of undefined behavior
which gcc and clang happen to handle differently.