Received: by 10.223.176.46 with SMTP id f43csp2252615wra; Thu, 25 Jan 2018 07:11:13 -0800 (PST) X-Google-Smtp-Source: AH8x227KnHynHM1AxyIpWaw7jq6YyQSMxFn9SN6Oqjc1vLN+ADepUPua6g4jbApsqHQ9cALfM+ex X-Received: by 2002:a17:902:d90a:: with SMTP id c10-v6mr11867934plz.200.1516893073857; Thu, 25 Jan 2018 07:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516893073; cv=none; d=google.com; s=arc-20160816; b=S/FORYF05lNEszF+S7BRKqFoQiJ12jpyFVfiHpCjJDrrYz+WqwGpjYoBmg6hPj8r8y VZbzUQ377aoaqzan4kk4O2eW7h0ZHvdNQhfdmg4nyor/qK0CvpaeDvvadEvV3LrOIVhh qyMX7xgs9kdfGs4CPbzbE7K34usk3nXExSrnS5E52CcqX+9PfGmwOn+R9YqXQLy04/Ca vZ4rpULxFuA2b53SzckyhNNfeVt4BLt39LDL/qpyX40sqPSzewDbI6r2iK/FviimS4Kf Eoa6IbJA5479M38PqLPBA2nCGLpCli2u2HSsw4h9N53IofMX8VGbrXTWf9Ql1sipW6dG 1jBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=GtIQLTQAv+n+KvSTgEXzpmGzcLLato+HLesnLR8qxAY=; b=RHEHGEV2LF8IjXEmr/DeXL/XWXx8gZ1Lnb87+XlOFSrdxNRMdmGUj1EgmwuH3T3Fj+ bifutzS3lyPVUHPaFcvCH6ro5Nf6MuZyJpdPdGEydLNXg3AMnHEAtCwdXYqegF4NIILI aGuSLSaFxaOFkN1mlccsY55gJoryu1faOSY7s93H9LpcS50IQoriv57HqaKECY8IoSB6 E1R9twdDqS+A3Vs2G6OaftPk3CF2i5sqOPOMxGI5yW1jNf5MwZzYNU0j6yrB7UWJyY7/ V3xCCnJxhGJsv3r6MrM+Ti1KVK0UyVhNY/qePFz5lAgpXxiCqW8BNFQkdx/uNPStOk9/ bIwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8-v6si2057103plz.719.2018.01.25.07.10.59; Thu, 25 Jan 2018 07:11:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751545AbeAYPKd (ORCPT + 99 others); Thu, 25 Jan 2018 10:10:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36446 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbeAYPKc (ORCPT ); Thu, 25 Jan 2018 10:10:32 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 015C7ACBF; Thu, 25 Jan 2018 15:10:32 +0000 (UTC) Received: from treble (ovpn-124-179.rdu2.redhat.com [10.10.124.179]) by smtp.corp.redhat.com (Postfix) with SMTP id 46F355D724; Thu, 25 Jan 2018 15:10:25 +0000 (UTC) Date: Thu, 25 Jan 2018 09:10:24 -0600 From: Josh Poimboeuf To: Borislav Petkov Cc: David Woodhouse , 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: <20180125151024.bidjr26r667vs7h5@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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180125124554.vdx7rrnfrxrzl2ng@pd.tnic> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 25 Jan 2018 15:10:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 25, 2018 at 01:45:54PM +0100, Borislav Petkov wrote: > > > +/* Like alternative_io, but for replacing a direct call with another one. */ > > > +#define alternative_void_call(oldfunc, newfunc, feature, input...) \ > > > + asm volatile (ALTERNATIVE("call %P[old]", "call %P[new]", feature) \ > > > + : : [old] "i" (oldfunc), [new] "i" (newfunc), ## input) > > > > But you aren't doing the call at all in the other case, and > > alternatives *always* handled the case where the first 'alternative' > > instruction was a branch, didn't it? > > > > So couldn't it just be alternative(nop, call __fill_rsb_func)? > > > > But I still don't understand why it matters. > > You need for both to be CALL instructions there so that gcc can manage > the callee clobbers properly - i.e., recognize that there's a function > call there. Huh? GCC doesn't even look inside the inline asm. That's why we had to implement ASM_CALL_CONSTRAINT. And the seg fault is objtool's way of telling you you need a ANNOTATE_NOSPEC_ALTERNATIVE above the alternative ;-) (I know that's not the best answer, will fix it soon.) -- Josh