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=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 C7801C433ED for ; Fri, 9 Apr 2021 07:58:33 +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 64409611AB for ; Fri, 9 Apr 2021 07:58:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64409611AB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine 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.107670.205780 (Exim 4.92) (envelope-from ) id 1lUm20-00055w-DR; Fri, 09 Apr 2021 07:58:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 107670.205780; Fri, 09 Apr 2021 07:58:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUm20-00055p-AU; Fri, 09 Apr 2021 07:58:20 +0000 Received: by outflank-mailman (input) for mailman id 107670; Fri, 09 Apr 2021 07:58:18 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUm1y-00055k-FH for xen-devel@lists.xenproject.org; Fri, 09 Apr 2021 07:58:18 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a2b02526-1fd3-411f-99f7-f4f0d0b1de9b; Fri, 09 Apr 2021 07:58:17 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D031CB138; Fri, 9 Apr 2021 07:58:16 +0000 (UTC) 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" X-Inumbo-ID: a2b02526-1fd3-411f-99f7-f4f0d0b1de9b 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=1617955096; h=from:from:reply-to: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=g1uwsH9Aqj04/mBNPbC4jZLd2FjLD9LdYZfFQh/hXgA=; b=nTxtHZd60NRU+9syYqNdaw7R4khcIkfoOZhmfrzLVDGyBNsWqxH39+E11HQCaUlIAWsRfx XBIb1tMa3/Oz7Rr+mzq+uYJFx0qIpfOaLpm2nBD6bNNrl63KWtNqK3CdQbVQ0G0CZALQa7 MLbMrRqX2Jx6+k1bK5jJF/kGrWrXWto= Subject: Re: [PATCH v3 4/7] x86: guard against straight-line speculation past RET From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <8e7d1472-dd37-8ed3-ec2f-ce954ea61dfd@suse.com> <0f717e5d-c1f7-ff0d-e136-16cea6b77de3@suse.com> Message-ID: <6f1a9b26-7775-3fdf-571e-d0ae87732099@suse.com> Date: Fri, 9 Apr 2021 09:58:15 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <0f717e5d-c1f7-ff0d-e136-16cea6b77de3@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 23.11.2020 14:44, 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). > > Signed-off-by: Jan Beulich > Acked-by: Roger Pau Monné So after committing I noticed that ... > v4: Drop left-over checking of clang for \(text) handling. > v3: Use .byte 0xc[23] instead of the nested macros. ... with this conversion the int3 was lost. Therefore I've reverted the commit, for not having any real effect. On top of this I've also noticed only now that this doesn't cover the issue everywhere - asm-macros.h doesn't get included by some of the files, and hence there the wanted transformation doesn't occur. But I'm not sure we want to force its inclusion uniformly, from e.g. asm-x86/config.h. Jan