From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224q6pPdhe6SKPfekIxp7RPffyr13535EhoVD0JttpZmLrrwHcAWsZUEAD/23B/djNWz40t7 ARC-Seal: i=1; a=rsa-sha256; t=1516901551; cv=none; d=google.com; s=arc-20160816; b=0i/kZlf0nS6KQT7gbRZuKuti6SonsaicCF8jkKZGqMig9Bnf1nOmakzAsvHTPRWSPw oxP4bmSRBPZc0Fv5OZ9t63M/KFMEGE2oo8HeC1I4RCpyJo/hPyixeXLdwArqnz/mZ+13 OTY2aiUuSNKKegYEJ/KIsPp2rV+5t3EydFBl3wfRxH6u7KxK/AFYjD2OyFfK2DqPrqYR trU0IVJWdUOCN7P39LhjRGgZreX2e81BVqeht5obJlUeoR50g23VWI/NgwXHe+7qFQCY awfErRuBSNt+3VGrtMXYl0A7n9Xk6q0m12ZNMF5gY+0gjn8h50eWcXkfm3hVNS7MX3CC 6rzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=XmZ1J8V0mmn6au2IaoU79FWnSP5OCD9WZuKLJzJTtL0=; b=WE9wXqKWIfvbPvkdaxQIeaA2BNZLqTTOM+cs7dWEBNBofjqKs48FOTOqgi2paLggGu 3cye2pkWgJq1L7tdboDinnuYNzYtwKVZVl05fClzIkkRbxNM5Ioudt9aQpJJyzWzuEo2 InsR/oH+gSTMuJU9u0vwgu0IaRakSxPtKSnTQP/iQpOxiM1Pw9dJItYB8zSxX92c9gnb MkVyeudrJKPB2hDCqEyAInOd9vwuERWRcGjq4pbNpXZiLjDMdIDlg4tnbC14K6KQRKcg Ll2ncPAZD0mLZw1S4VlV4s5G7gsUUph3Dd8wzZI2+1wW06UK0mSJ+/G7MvoeCVZfm7DM GvuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jpoimboe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jpoimboe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of jpoimboe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jpoimboe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Date: Thu, 25 Jan 2018 11:32:24 -0600 From: Josh Poimboeuf To: David Woodhouse Cc: Borislav Petkov , tim.c.chen@linux.intel.com, pjt@google.com, jikos@kernel.org, gregkh@linux-foundation.org, dave.hansen@intel.com, mingo@kernel.org, riel@redhat.com, luto@amacapital.net, torvalds@linux-foundation.org, ak@linux.intel.com, keescook@google.com, peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/pti] x86/retpoline: Fill return stack buffer on vmexit Message-ID: <20180125173224.ynvqjriah73cfk7q@treble> References: <1515755487-8524-1-git-send-email-dwmw@amazon.co.uk> <20180125120743.ey32gvl5mjam4r2s@pd.tnic> <1516882849.30244.94.camel@infradead.org> <20180125124554.vdx7rrnfrxrzl2ng@pd.tnic> <20180125151024.bidjr26r667vs7h5@treble> <20180125155110.mw655b7fwgm7qqc7@pd.tnic> <1516896198.30244.133.camel@infradead.org> <20180125165646.ytc4upthpaqtwi45@treble> <1516899639.30244.145.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1516899639.30244.145.camel@infradead.org> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1589334225298273984?= X-GMAIL-MSGID: =?utf-8?q?1590586561350835839?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Thu, Jan 25, 2018 at 05:00:39PM +0000, David Woodhouse wrote: > On Thu, 2018-01-25 at 10:56 -0600, Josh Poimboeuf wrote: > > On Thu, Jan 25, 2018 at 04:03:18PM +0000, David Woodhouse wrote: > > > On Thu, 2018-01-25 at 16:51 +0100, Borislav Petkov wrote: > > > >  > > > > > And the seg fault is objtool's way of telling you you need a > > > > > ANNOTATE_NOSPEC_ALTERNATIVE above the alternative ;-) > > > >  > > > > Except that it blew up when I did this which doesn't have ALTERNATIVE > > > > (it's the diff I saved :-)) > > >  > > > Yeah, ANNOTATE_NOSPEC_ALTERNATIVE just tells objtool "don't look at the > > > alternative; you're not going to like it". > > >  > > > If you start putting a __fill_rsb() function out of line somewhere and > > > only *calling* it from alternatives, then objtool is going to shit > > > itself when it sees that function, regardless. > > > > Right, if you *really* want it always inline, the short term solution is > > to just patch it in with X86_FEATURE_ALWAYS. > > And the whole problem here is that patching it in with alternatives is > painful on kernels < 4.1 because back then, we didn't cope with > oldinstr and altinstr being different lengths. We just manually added the nops for the in-line path, that should be good enough. -- Josh