From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751557AbdHaPV5 (ORCPT ); Thu, 31 Aug 2017 11:21:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37986 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbdHaPV4 (ORCPT ); Thu, 31 Aug 2017 11:21:56 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AF5CD883DC Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jpoimboe@redhat.com Date: Thu, 31 Aug 2017 10:21:53 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Linus Torvalds , Alexander Potapenko , Dmitriy Vyukov , Matthias Kaehlcke , Arnd Bergmann Subject: Re: [RFC PATCH 4/4] x86/asm: Use ASM_CALL() macro for inline asm statements with call instructions Message-ID: <20170831152153.dre6gjdqcucmi5oc@treble> References: <20170831145041.wnsqimcm54wa6yja@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170831145041.wnsqimcm54wa6yja@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 31 Aug 2017 15:21:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Josh