Received: by 10.223.176.5 with SMTP id f5csp1242985wra; Tue, 6 Feb 2018 15:33:56 -0800 (PST) X-Google-Smtp-Source: AH8x226Uwo/10bBUUYFYfnxz80NEYDUcwdBXh+IS2knyUkGgeFtJGh2lj2iL26939Hcvl9R10pWq X-Received: by 10.101.101.84 with SMTP id a20mr3263939pgw.163.1517960036151; Tue, 06 Feb 2018 15:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517960036; cv=none; d=google.com; s=arc-20160816; b=HaErDYoWrbt8Io3akDmSljgE4nW7Jr97uH3dwDMjgJ5+udCK3n+PZ0d+HuFWV3C2KA /lnOCYcgXPuuIy4TYU4V1Qnmq/mst3r5b4hrYpE4t0+1Yw0MKSXaRSrzGYpjVZgbcq4u GwtqZgeWWZBfdHjJ6OR9D9KCO4smVxHRLpFq8heq9nwxSPOoR05sNQT/PYUwhfuhAzKa bZWRR8icDSO0Vf7nApiq3ov0dkAAwSIStEFnSdgEnn51+wotDL2V1RwHkYr5Y+FXqUDh 6hi+X+4RrqqqBBE7/UtGBXGt4d0sdTAGCl9HAHnLOtfj9tyALEdHwGBP0GAfuCxI5fSw OeOA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=/E+DD1lKNfktXsOkirTNdvxFmjKwyYx0nE7RrENYXVQ=; b=SlWfz4g9ekkf5cdGQk0julTWPlLMRwaCTkiFcjGssMwdrHAxN205MPc43Vgyex7xgt ozFUrM125LPX6e3Lm30JWMgBks1HYXMgekWass40Nl0wnXr8rW/Y6XoS6UIARxIypoAa NpKAorfUHC+znyEu7t7nC2rb4ibwXxaDPxwx727nP7GErOTBwyefo48FH7zwGfKzPDkJ f7yTaHJSWwVMem/MBUz7MZ6csIJGLBmnyI4HUFbXoyxjDx65eYopq2ct+QZTuiBapwd6 P0UCoH86sRH2pnuPC317IKPLPI09FMpOQBViUzOHInf7P9rZd2mTaivB6Vm6y80nwfCp fwWQ== 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 v12si107590pgq.50.2018.02.06.15.33.37; Tue, 06 Feb 2018 15:33:56 -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 S1753876AbeBFXct (ORCPT + 99 others); Tue, 6 Feb 2018 18:32:49 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43166 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753302AbeBFXcs (ORCPT ); Tue, 6 Feb 2018 18:32:48 -0500 X-Greylist: delayed 450 seconds by postgrey-1.27 at vger.kernel.org; Tue, 06 Feb 2018 18:32:48 EST Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FAE740363BB; Tue, 6 Feb 2018 23:25:18 +0000 (UTC) Received: from treble (ovpn-122-204.rdu2.redhat.com [10.10.122.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CF9F2166BB2; Tue, 6 Feb 2018 23:25:14 +0000 (UTC) Date: Tue, 6 Feb 2018 17:25:14 -0600 From: Josh Poimboeuf To: David Woodhouse Cc: Borislav Petkov , X86 ML , LKML , tim.c.chen@linux.intel.com, pjt@google.com, jikos@kernel.org, gregkh@linux-foundation.org, dave.hansen@intel.com, riel@redhat.com, luto@amacapital.net, torvalds@linux-foundation.org, ak@linux.intel.com, keescook@google.com, peterz@infradead.org Subject: Re: [PATCH 2/2] x86/speculation: Simplify indirect_branch_prediction_barrier() Message-ID: <20180206232514.qcy4y3dzfkjo3xdg@treble> References: <20180126121139.31959-1-bp@alien8.de> <20180126121139.31959-4-bp@alien8.de> <1516970011.30244.223.camel@infradead.org> <20180126132431.fsbd3c3g2yreazy6@pd.tnic> <1516983879.30244.236.camel@infradead.org> <20180126164746.dpo7dswid5tjk2tz@pd.tnic> <20180126200616.5xfn244uzeu7ptyo@pd.tnic> <20180126200813.cignvfovk2dhlzbh@pd.tnic> <1517946292.3677.22.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1517946292.3677.22.camel@infradead.org> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 06 Feb 2018 23:25:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 06 Feb 2018 23:25:18 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 06, 2018 at 07:44:52PM +0000, David Woodhouse wrote: > On Fri, 2018-01-26 at 21:08 +0100, Borislav Petkov wrote: > > Make it all a function which does the WRMSR instead of having a hairy > > inline asm. > > ... > > > + alternative_input("", > > +  "call __ibp_barrier", > > +  X86_FEATURE_IBPB, > > +  ASM_NO_INPUT_CLOBBER("eax", "ecx", "edx", "memory")); > >  } > > Dammit. I know the best time to comment is *before* I add my own sign- > off to it and before Linus has merged it but... I think this is broken. > > If you're calling a C function then you have to mark *all* the call- > clobbered registers as, well, clobbered. > > If you really really really want to *call* something out of line, then > it would need to be implemented in asm. Hm. In theory I agree this seems like a bug. On x86_64 I believe we would need to mark the following registers as clobbered: r8-r11, ax, cx, dx, si, di, plus "memory" and "cc". But I'm scratching my head a bit, because we seem to have this bug all over the kernel. (Grep for ASM_CALL_CONSTRAINT to see them.) Many of those inline asm calls have been around a long time. So why hasn't it ever bitten us? -- Josh