Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp647918ybb; Fri, 3 Apr 2020 09:17:02 -0700 (PDT) X-Google-Smtp-Source: APiQypJhU33Z7UzOEhRX66+0QxERXRwCeJRU2eJ/c0RHRkrLkrd3Zs+yT5H28PaDh8FRB30zG8el X-Received: by 2002:aca:56cd:: with SMTP id k196mr3779545oib.85.1585930622676; Fri, 03 Apr 2020 09:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585930622; cv=none; d=google.com; s=arc-20160816; b=kWZCr5Xfo29RHoNAYpyTZyW6OZbKpLKvGW+FDH1wdaz7gzWZR2m/618kCC+nPbd5Ob +aGNiCGIoowEB69Cpc6sGqAcpF8N5NpAroDuI+3ichto8+LUGWG7DSNVNO3jGLfAIVjH IStSrOSXk4FcP9I52G9vjnhC9CdaR0r9Dm/ihsckmsUj/727HpaHNEDgCtvyi2E+mJSy ZH/RxYYvW25tcCSYzx2DE3wZCFzjR0qlpWg6RbY9bBgZbtPQzGJzPRSOuWAPUyWizkBN 9+JKmqtDYm716jPUldFn+YSeqDCbC/q2ms1JD33F0UEzaxGti3oZYi2ztL1KfjqfkCkX AWcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=HdCOAJQBf5kjshxNb+3zZTkGKBqwGXfbMXAkL5oZvvg=; b=twUV1FrR4L4Zh12b73unEVJKQgPNG4WfDeC06LkVcbHl62mWeduom2PYkpv8UkJNFE l/n9QYZ6+w9VU650C+xAAY8BgJ14lB4tfJtGI87grjyPLBbU566lk+arykA4i/950Smy APGbrnIpjTgpbWiE6vFNp3LJzpMUrpxThYnJfQlaeTjMS+oFEUWyKoJJiGcMaQLl4ECy CHIVC+EjrPabTt3+425IhH+y+aFxB8eVxwARnyPfriK4ZALwDfO4lTnENmtyiRjKMZeu +ZvJOICUph0z60XEBOb5KlnYNI5eVcp1PlcfAbtGK6wgN2ChUyIphryqnlISy2JBAi2r Z7Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EqNQky+S; 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=pass (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 i204si3878841oif.245.2020.04.03.09.16.50; Fri, 03 Apr 2020 09:17:02 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EqNQky+S; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404195AbgDCQQR (ORCPT + 99 others); Fri, 3 Apr 2020 12:16:17 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:36770 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404071AbgDCQQQ (ORCPT ); Fri, 3 Apr 2020 12:16:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585930575; 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: in-reply-to:in-reply-to:references:references; bh=HdCOAJQBf5kjshxNb+3zZTkGKBqwGXfbMXAkL5oZvvg=; b=EqNQky+Sd6E0tliAF/NE/agol1q7mhFAhE4ctd3mSsw0DA3vp8LoSxM8rWunSFpA7ku4Li pnuGXyamxZPwvJaDfXorkUSir71HU22OBahAr5VAfNqzexQAVc0sFHDhdO0CtdsiJ3wznk X3yGpRjmqtl2CQSVnAZNzk4j79Vj3UE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-334-RM_xudjgP22Rpw0iwHMPKA-1; Fri, 03 Apr 2020 12:16:13 -0400 X-MC-Unique: RM_xudjgP22Rpw0iwHMPKA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31D35A0CC0; Fri, 3 Apr 2020 16:16:12 +0000 (UTC) Received: from treble (ovpn-118-100.rdu2.redhat.com [10.10.118.100]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC76F10027A3; Fri, 3 Apr 2020 16:16:10 +0000 (UTC) Date: Fri, 3 Apr 2020 11:16:07 -0500 From: Josh Poimboeuf To: Alexandre Chartre Cc: x86@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, jthierry@redhat.com, tglx@linutronix.de Subject: Re: [PATCH 5/7] x86/speculation: Annotate intra-function calls Message-ID: <20200403161607.jxz6duaz7dud22wf@treble> References: <20200402082220.808-1-alexandre.chartre@oracle.com> <20200402082220.808-6-alexandre.chartre@oracle.com> <20200403160538.qwu237amhanr6pyi@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200403160538.qwu237amhanr6pyi@treble> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 03, 2020 at 11:05:38AM -0500, Josh Poimboeuf wrote: > On Thu, Apr 02, 2020 at 10:22:18AM +0200, Alexandre Chartre wrote: > > .macro RETPOLINE_JMP reg:req > > - call .Ldo_rop_\@ > > + INTRA_FUNCTION_CALL .Ldo_rop_\@ > > .Lspec_trap_\@: > > pause > > lfence > > @@ -102,7 +116,7 @@ > > .Ldo_retpoline_jmp_\@: > > RETPOLINE_JMP \reg > > .Ldo_call_\@: > > - call .Ldo_retpoline_jmp_\@ > > + INTRA_FUNCTION_CALL .Ldo_retpoline_jmp_\@ > > .endm > > There's a catch: this is part of an alternative. Which means if > X86_FEATURE_RETPOLINE isn't set at runtime, then the retpoline won't be > there and the ORC data will be wrong. > > In fact objtool should probably be made smart enough to warn about this > situation, when an alternative changes the stack state. > > The only way I can think of to fix this is to have ORC alternatives :-/ Or they could be converted to use static branches instead of alternatives. -- Josh