Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E0DDC388F7 for ; Tue, 10 Nov 2020 13:20:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0494F20797 for ; Tue, 10 Nov 2020 13:20:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="Sf/jqmcV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0494F20797 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.23378.50071 (Exim 4.92) (envelope-from ) id 1kcTYn-0001oH-T7; Tue, 10 Nov 2020 13:19:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 23378.50071; Tue, 10 Nov 2020 13:19:45 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcTYn-0001oA-Q8; Tue, 10 Nov 2020 13:19:45 +0000 Received: by outflank-mailman (input) for mailman id 23378; Tue, 10 Nov 2020 13:19:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcTYm-0001o0-Do for xen-devel@lists.xenproject.org; Tue, 10 Nov 2020 13:19:44 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ca5d3cd4-0a20-4a0a-865d-a307583a7e8a; Tue, 10 Nov 2020 13:19:41 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D0453ABCC; Tue, 10 Nov 2020 13:19:40 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcTYm-0001o0-Do for xen-devel@lists.xenproject.org; Tue, 10 Nov 2020 13:19:44 +0000 X-Inumbo-ID: ca5d3cd4-0a20-4a0a-865d-a307583a7e8a Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ca5d3cd4-0a20-4a0a-865d-a307583a7e8a; Tue, 10 Nov 2020 13:19:41 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1605014380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xjIxpzoJoK2RSmU+/Sp56xcGMtt7dE1k677M7iQdhr0=; b=Sf/jqmcV09prnR3VZfsTw7JOT4nFDEAmgPie/XOceYuIAy+77v+rzSsKqHSD48N2nAvvpc 0CKh2O+eheI3BSXGn/BgeDG5MdYGUNgBH1qh4cdRrurbo8eTt1mOR4SjaIFOCJaVPTIBpq Qpjh8ticDZuHqkFwQH0emVb1uuGkHlc= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D0453ABCC; Tue, 10 Nov 2020 13:19:40 +0000 (UTC) Subject: Re: [PATCH v3 5/7] x86: guard against straight-line speculation past RET To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , Wei Liu References: <7065e2dc-f846-be79-1081-682c2295358c@suse.com> <80ceea17-958d-f409-5f39-9f353e780f5b@suse.com> <20201110093142.hkufamaepn67gv43@Air-de-Roger> <92e58ff0-e6a4-f92f-1ad6-06db7751762a@suse.com> <20201110111603.rarf7ncddrkswlxs@Air-de-Roger> From: Jan Beulich Message-ID: <586bb9e5-bb90-bb27-3010-e702d65e301c@suse.com> Date: Tue, 10 Nov 2020 14:19:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: <20201110111603.rarf7ncddrkswlxs@Air-de-Roger> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 10.11.2020 12:16, Roger Pau Monné wrote: > On Tue, Nov 10, 2020 at 11:06:46AM +0100, Jan Beulich wrote: >> On 10.11.2020 10:31, Roger Pau Monné wrote: >>> On Fri, Oct 23, 2020 at 10:38:04AM +0200, Jan Beulich wrote: >>>> Under certain conditions CPUs can speculate into the instruction stream >>>> past a RET instruction. Guard against this just like 3b7dab93f240 >>>> ("x86/spec-ctrl: Protect against CALL/JMP straight-line speculation") >>>> did - by inserting an "INT $3" insn. It's merely the mechanics of how to >>>> achieve this that differ: A set of macros gets introduced to post- >>>> process RET insns issued by the compiler (or living in assembly files). >>>> >>>> Unfortunately for clang this requires further features their built-in >>>> assembler doesn't support: We need to be able to override insn mnemonics >>>> produced by the compiler (which may be impossible, if internally >>>> assembly mnemonics never get generated), and we want to use \(text) >>>> escaping / quoting in the auxiliary macro. >>> >>> Could this have an option to enable/disable at build time? >> >> Well, a subsequent patch adds a config option for this, which in >> the worst case could be turned off. I'm afraid though I'm not >> clear about the question, because ... >> >>> FreeBSD will drop GNU as quite soon from base, and albeit it can be >>> installed as a package I would like to be able to build Xen using a >>> toolchain based on LLVM exclusively. >> >> ... it's not clear to me what the implications here are: Are you >> saying -no-integrated-as is not going to function anymore, unless >> people explicitly install gas? If that's not what you meant to >> indicate, then I don't see how building would become impossible. > > I'm still inquiring about this, but I would say that when gas is > removed from FreeBSD then the 'as' command would be mapped to llvm-as, > and thus -no-integrated-as would hit the same issues as the integrated > as. So far in Xen we have assumed that -no-integrated-as would > fallback to an as capable of doing what the integrated clang as > doesn't support, but that might not be the case. At which point Xen couldn't be built anyway, I expect. If llvm-as isn't sufficiently gas-compatible, we've lost (right now at least). > Ideally we would have to re-run the tests with -no-integrated-as, in > order to assert that the external as is really capable of what the > internal one is not. And if it doesn't, what would we do other than failing the build (which it would also if we didn't do the 2nd round of checks)? Jan