Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4383467ybb; Tue, 7 Apr 2020 06:31:22 -0700 (PDT) X-Google-Smtp-Source: APiQypKN3r2IL8rjpjI6yJorEPLmlmY1gyvhOuWRoO57GD8vIxwd6zh129WOCUue0RZ+UGY2ArC0 X-Received: by 2002:aca:4142:: with SMTP id o63mr1628161oia.118.1586266282794; Tue, 07 Apr 2020 06:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586266282; cv=none; d=google.com; s=arc-20160816; b=i4+3J6knywGndnvke8X9QKci62T05NT4FbAjfAOwJEGWn4v5p+s217BRS3KaDxN5Fk H0KKWe0uGY2dyvKplJL1yjCj60E7Y5wa9gbGsBjd6jjb/OqlDBfIs+G1zR1wysv6wq5c aMuhcq/9tLbpeJJPA5KEsAfPHeu2vuewnDYjzW9gZ7BH3efI9/GdK805j1+pUypGMZw4 Mc78Ra2kHzebWA/4DMrPx+FwN3XGmawzc7uHmq2Xooh+X+KIky9qfzvvyCFECxtORT2H dp0GsQEVnb8qpZCZGP0MpUaEa2QtEEkZxaVeEG1sBuDtQKIGpe1DguQm1qCg/tLv2EzX KUEg== 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=FABG1nsUHC99ShEuLwmDippLPOdYOOruooCxAiRmuhs=; b=jOYmg7VSkqvpx2GiE33r3o1PVgq90L9VmJGkSbf4MAbsDF9sc7Dz8CXoeRqqRlWSXr TThxTB83vgafPms+YPVXpZfj/BCURkr16yXjSwXuP11jXmQmzLzlMhJu4mjjHNTZ1HDT Fthe7filK4SaBkUfD5V6QzXkhffdTaToIG1xyrlaM039CmSv6VqjWcm9N06c7iMQfA8E xoXr9ff8pAlsr0wH4JedDF1uPF7aTaYOpWPBbIHFXBx1K3osdeLVZNjfnmhOuDJft+gv 16yiAloDrFEjN382jYLOlOwfmFC951yw3W6YS9VeEISu7SfhFA7Wpd8a45lBmJVuano0 0O/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="GHzN/uRc"; 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 l126si1079508oih.31.2020.04.07.06.31.09; Tue, 07 Apr 2020 06:31:22 -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="GHzN/uRc"; 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 S1728810AbgDGN2p (ORCPT + 99 others); Tue, 7 Apr 2020 09:28:45 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43072 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbgDGN2o (ORCPT ); Tue, 7 Apr 2020 09:28:44 -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; bh=FABG1nsUHC99ShEuLwmDippLPOdYOOruooCxAiRmuhs=; b=GHzN/uRc/BMFdpy3BouGji/K// +Z6DYoWnPnQJXxR7gdL40oyG4486KAo6RF39nVPINJCP9UxF5z0GYEpePvsXD8vaOsi7GnMN/soHi uInUeMygfP4Dumy8QeD4hRKl+2ebbi2jYCEJnshZ/EkBZF53RqLM0XTuBYQZh72X8SVVXzrn44Igh 4ndaAvewTfBFaWs9D1SFUIco+aSkBMBVYpsygPpnBbLwtoGvkqcsme5tq1PeNOnn6R2Z8KHw5Dste D+k2mPSA510vHT4nA17lAqsx02rvS+4I+lAE8PmfZCuvlag5odRM+PpCYZ+jekYf+tUvvKItagOJi yycPv0sQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jLoHQ-0003da-4Q; Tue, 07 Apr 2020 13:28:40 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 19D273011DD; Tue, 7 Apr 2020 15:28:38 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 039B02B907A96; Tue, 7 Apr 2020 15:28:37 +0200 (CEST) Date: Tue, 7 Apr 2020 15:28:37 +0200 From: Peter Zijlstra To: Alexandre Chartre Cc: x86@kernel.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, jthierry@redhat.com, tglx@linutronix.de Subject: Re: [PATCH V2 9/9] x86/speculation: Remove all ANNOTATE_NOSPEC_ALTERNATIVE directives Message-ID: <20200407132837.GA20730@hirez.programming.kicks-ass.net> References: <20200407073142.20659-1-alexandre.chartre@oracle.com> <20200407073142.20659-10-alexandre.chartre@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200407073142.20659-10-alexandre.chartre@oracle.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 07, 2020 at 09:31:42AM +0200, Alexandre Chartre wrote: > Now that intra-function calls have been annotated and are supported > by objtool, that retpoline return instructions have been annotated, > and that __FILL_RETURN_BUFFER code is compatible with objtool, then > all ANNOTATE_NOSPEC_ALTERNATIVE directives can be removed. Like Josh said in the previous thread, this isn't going to work right. > - ANNOTATE_NOSPEC_ALTERNATIVE > ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *\reg), \ > __stringify(RETPOLINE_JMP \reg), X86_FEATURE_RETPOLINE, \ > __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *\reg), X86_FEATURE_RETPOLINE_AMD The problem is that while objtool can now understand the code flow and the corresponding stack layout, we only have a single ORC table, one that must be valid for all alternatives. Effectively this means there should not be any orc entries in an alternative range. In practise it _might_ work when the instruction of the various alternatives have unique offsets in the range. But I'm not entirely sure of that. Josh, we should probably have objtool verify it doesn't emit ORC entries in alternative ranges.