Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4609293yba; Wed, 10 Apr 2019 00:45:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzypkvn3KnXesWfD9uC25KUQ81oQl1jzEx46yvha/PDzUkYfRMydvYE4ZCGPUvPpDlxquqZ X-Received: by 2002:a63:e653:: with SMTP id p19mr38920892pgj.284.1554882324622; Wed, 10 Apr 2019 00:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554882324; cv=none; d=google.com; s=arc-20160816; b=VO75WQVqIY0R2EZKiGppkthlY2OG0Zioje8RfwUTTeJ7f98McVcfK/MuL0wm1vFReK zJHajnHvIqqV93RToqhu09HOD6m8C6Bh97I+qak/xYqG4E+p39Su3f2FuKBaaF4xXm+x vhfXFrL7iVx8MDwWrVX5fSeuqmiE9rfL/mugCKz/8hk4I6ZXgoSLlSMyu0xCEkhDTVvH bfQagUIkC/f9l5xa1wgO6Y7q1BHpcwF/MX74Ji2nsxH/LqKwN54b2XqbmWwsUz+cBk/V IZk5jy8kjLCHVwqYF5rdMmTi1mGeDYtV5/2gZork2C4WMqps7SCOmZVpBpCelQ25mmop kzlg== 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:dkim-signature; bh=CfDh/xNSvQ6EpIdUx9RPQ4MIQT/XHWChd9LJLZS9JsE=; b=f8OL95wJbKjg6oplRpy0aRxHilWvNroC1mE4Vb8UO8dU6cHraJZ82I3eJFVEve3PzZ 1Wkqv1QxZEEGrwbFjlyTFrbeLqSklQzyJLpvCISAUYvYQ2dznL1pY+RaLECCwqQFmE2i 1tbJ7cBOL72uIZ72seiMbEIpnWuD3xLEUqcnfhMsvlzJ+/Y/iz+4cA10P0kWLrAapwgO 3IK8xp/vTwHHBuT6MY8s8WnTSUSOUVzQibtRmOicZ4WVS8yBMmQxqY9bj9v43q//ezMn g7xkF2DHdD0UPl1bRcGpw9cVaxcRyQ0iISBl1H+lTvtM+nizSbIE5F+JDNwY4GodL5uP yB1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kV0N3dlj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h128si31095206pgc.488.2019.04.10.00.45.08; Wed, 10 Apr 2019 00:45:24 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kV0N3dlj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728632AbfDJGyb (ORCPT + 99 others); Wed, 10 Apr 2019 02:54:31 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54228 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbfDJGyb (ORCPT ); Wed, 10 Apr 2019 02:54:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CfDh/xNSvQ6EpIdUx9RPQ4MIQT/XHWChd9LJLZS9JsE=; b=kV0N3dlj2s/HL8wFzcoLue67i CZOFlZ/q5xB4uwQjY97aF9FGscWcMAneQnU8II+ElbJBIyL+ztLj/AnAen8Z+Wj/u58PHN7Cys/SF yqQ+dsKbESdMtI2v01C67Q9QHjSnJ0MeH4Kv41py/jsAhLsgVgIyCF8eZ1g0OZKpzKRjlsXDfoTAi GQfp11BXTLRrojPUImTKIhVDzC5Y7wWrgyNHX0ZR+TGMrpqkiAbBOLh+Z8ulVcqg2J5GD6suFaLSi hkruuFIq9usoLLmoj35UL0SdkNSsYisCXwUoYHZGf5FBsrAUKmKnLWNkwuZB6713/7Mih/wpbYMKI 8FsnA06fw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hE77k-0000sW-6c; Wed, 10 Apr 2019 06:54:20 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 02E45201F29A7; Wed, 10 Apr 2019 08:54:17 +0200 (CEST) Date: Wed, 10 Apr 2019 08:54:17 +0200 From: Peter Zijlstra To: Mathieu Desnoyers Cc: Thomas Gleixner , Andy Lutomirski , "H. Peter Anvin" , Andi Kleen , Ingo Molnar , Borislav Petkov , libc-alpha , linux-kernel , Carlos O'Donell , x86 Subject: Re: rseq/x86: choosing rseq code signature Message-ID: <20190410065417.GU11158@hirez.programming.kicks-ass.net> References: <11513896.2624.1554838336494.JavaMail.zimbra@efficios.com> <913288111.2663.1554842622822.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <913288111.2663.1554842622822.JavaMail.zimbra@efficios.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 09, 2019 at 04:43:42PM -0400, Mathieu Desnoyers wrote: > +/* > + * RSEQ_SIG is used with the following privileged instructions, which trap in user-space: > + * x86-32: 0f 01 3d 53 30 05 53 invlpg 0x53053053 > + * x86-64: 0f 01 3d 53 30 05 53 invlpg 0x53053053(%rip) > + */ Right, and the alternative is: 0f b9 3d $SIG, which decodes to: UD1 $SIG(%rip),%edi which will trap unconditionally. The only problem is that gas will not actually assemble it, but since we're .byte coding it, it doesn't matter. UD1 is specified by both AMD and Intel to take a ModR/M, unlike UD0 where they disagree on the ModR/M.