From: Dmitry Vyukov <dvyukov@google.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
"x86@kernel.org" <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Alexander Potapenko <glider@google.com>,
Matthias Kaehlcke <mka@chromium.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [RFC PATCH 4/4] x86/asm: Use ASM_CALL() macro for inline asm statements with call instructions
Date: Thu, 31 Aug 2017 17:36:45 +0200 [thread overview]
Message-ID: <CACT4Y+YgoyqnhrKpyfW4HKv_Y1KNUL-yPJCd-s52zCArSep-Lg@mail.gmail.com> (raw)
In-Reply-To: <20170831152153.dre6gjdqcucmi5oc@treble>
On Thu, Aug 31, 2017 at 5:21 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Thu, Aug 31, 2017 at 04:50:41PM +0200, Peter Zijlstra wrote:
>> On Thu, Aug 31, 2017 at 09:11:20AM -0500, Josh Poimboeuf wrote:
>> > Inline asm statements which have call instructions can be problematic.
>> > GCC doesn't know about the call instructions, so in some cases it can
>> > insert the asm before setting up the frame pointer. This can result in
>> > bad stack traces when unwinding from the called function.
>> >
>> > Previously we worked around this issue by listing the stack pointer as
>> > an input/output constraint for the inline asm. That works for GCC, but
>> > unfortunately it doesn't work for Clang. In fact, it causes Clang to
>> > corrupt the stack pointer.
>>
>> Sounds like it ought to get fixed regardless and then it might as well
>> do the right thing ;-)
>
> There was some disagreement about what the "right thing" is because it's
> an undocumented and unintuitive interface.
>
> And I use the term "interface" loosely. It was apparently a side effect
> which was mentioned to me on the GCC mailing list.
Yes, as far as I understand, there is just no defined semantics for
this. Passing sp as is when asm block asks to pass in sp looks like a
perfectly reasonable thing to do (also faster code). We could use
something like asm("..." ::: "frame"), but we don't have this in
compilers.
prev parent reply other threads:[~2017-08-31 15:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 14:11 [RFC PATCH 0/4] x86/asm: Add ASM_CALL() macro for inline asms with call instructions Josh Poimboeuf
2017-08-31 14:11 ` [RFC PATCH 1/4] x86/paravirt: Fix output constraint macro names Josh Poimboeuf
2017-08-31 14:11 ` [RFC PATCH 2/4] x86/asm: Convert some inline asm positional operands to named operands Josh Poimboeuf
2017-08-31 14:11 ` [RFC PATCH 3/4] x86/asm: Make alternative macro interfaces more clear and consistent Josh Poimboeuf
2017-08-31 16:11 ` Linus Torvalds
2017-08-31 17:25 ` Josh Poimboeuf
2017-08-31 17:31 ` Josh Poimboeuf
2017-09-02 10:32 ` Ingo Molnar
2017-09-14 14:48 ` Josh Poimboeuf
2017-09-14 17:16 ` Linus Torvalds
2017-09-14 17:26 ` Josh Poimboeuf
2017-09-14 17:33 ` Josh Poimboeuf
2017-09-14 18:28 ` Linus Torvalds
2017-09-14 18:45 ` Josh Poimboeuf
2017-09-15 16:10 ` Josh Poimboeuf
2017-09-15 16:53 ` Andrey Ryabinin
2017-09-15 17:20 ` Josh Poimboeuf
2017-09-15 18:01 ` Linus Torvalds
2017-09-15 23:29 ` Josh Poimboeuf
2017-09-16 22:22 ` Andrey Ryabinin
2017-09-18 17:40 ` Josh Poimboeuf
2017-09-19 16:02 ` Josh Poimboeuf
2017-08-31 14:11 ` [RFC PATCH 4/4] x86/asm: Use ASM_CALL() macro for inline asm statements with call instructions Josh Poimboeuf
2017-08-31 14:50 ` Peter Zijlstra
2017-08-31 15:21 ` Josh Poimboeuf
2017-08-31 15:36 ` Dmitry Vyukov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACT4Y+YgoyqnhrKpyfW4HKv_Y1KNUL-yPJCd-s52zCArSep-Lg@mail.gmail.com \
--to=dvyukov@google.com \
--cc=arnd@arndb.de \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=mka@chromium.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).