Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1124223rdg; Wed, 11 Oct 2023 15:36:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoZobRFCcV2FZ/4XnBXR4wJUZzfuoFr9M/FCvkJW3nqdDVNMLAtnO9zie2z5sV+lYquHWV X-Received: by 2002:a05:6a21:1f12:b0:149:f82a:2640 with SMTP id ry18-20020a056a211f1200b00149f82a2640mr17207816pzb.30.1697063778560; Wed, 11 Oct 2023 15:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697063778; cv=none; d=google.com; s=arc-20160816; b=S/CocqRWCawIxyyKOry7hZMVhzCAU71q15ytUqcAfcjsoB7hVOzf4AhaOHOPX52MXe egToLi3FrjtSZil4HI9ckwC6dpOVsJO6B0pIfLJ4J/L4GMo5vnrnOlDOmd30to+Y5TNv wBi3Zg/bDvyS3dtbZDbQDOxrHoFFEbf/rM7WxZn7ZoB2dXXcPUnXxgpHHVLWPbKihjKK T+waGbEIsveIMDImow9+3KcqtsWxDJz3kMskAF7RRpDvyP2dYDpgW9+pwJM25cxSe7mC pbi7hDWIQAPuffNNAz9AcG3X8tpRYJpRtzLFZHhZU9URnPlKZkGkvvUn/oS1q3LQxA+k TRaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/rH5k2R7fy3EeoPgRJEoHWfNJ/FGZ9dJZ3C37UjXiug=; fh=RG1OcOTtXcueKgnCmYB0MOApSppAqDAbmT1u5P23fqs=; b=oguWnakn7y/x9J6s5yIDP07QlF8Eh/qGBIOo818dlzDUbUfoy6m4XW17CSvOJGwUZU p+RMWeCy3EF8Xs8mU6YihIgHujE4S3Ie09wpkjjlPEsuzbYdTwabmtJZC39lsgJWaCbm hwobysP4COis0caS1E3ARYE6oBqoAR4BM9FC2b8ZW3tkFEmlqOACnXQYDI3UuZvrBzyD s3J4NXLNBPs99IslBfe16PU99tQCY0TrV1IYOwohfF6n2DwCIZSeO53rVCE2ag/7chyq N88pXQkQFMHUArdx7bw9k1TqYS5WrQpx9clpm2iY1Xi+tOJfFX2+8ea2mFcmxckWiHUy yeYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Z6IWx8By; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id s4-20020a170902a50400b001b9eb349549si213461plq.630.2023.10.11.15.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 15:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Z6IWx8By; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id C8B8B80ACC48; Wed, 11 Oct 2023 15:36:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233444AbjJKWfg (ORCPT + 99 others); Wed, 11 Oct 2023 18:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbjJKWff (ORCPT ); Wed, 11 Oct 2023 18:35:35 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 324B9A4 for ; Wed, 11 Oct 2023 15:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=/rH5k2R7fy3EeoPgRJEoHWfNJ/FGZ9dJZ3C37UjXiug=; b=Z6IWx8ByB3DoEZ2EIT+qjX8EQa ZxbWN/kHMTDoa81yCjS+9XYW39v1HJtZvs8H8OfAnYGTr9BWf7eRHBk8k1B7BxtuwlU4w5F9FjWWh 4KDJvxkeS4nFPl/xOSR0ipDBBiDQ9WdIQEfBDT+Z1ylgBBuFge/EzwnV7IsZa6ea789lnBk9jDFwF uFRj4qf/vm2MlLY+5d2ZnO0LY2x+Cay4YbhnOfmyOWPLbPyp/txQDW5/ADsw9YQb0aCCI4G0nubYN Cdgakk0iJYklupjo9DKOdh30WQUQdMUVuEx3H3ouEwmA4ZMijq69m/aZMF45NmJEENFZNHoILhcfk GeTLzaPA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qqhnM-000ZjG-23; Wed, 11 Oct 2023 22:35:14 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id BB88D30036C; Thu, 12 Oct 2023 00:35:13 +0200 (CEST) Date: Thu, 12 Oct 2023 00:35:13 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: Borislav Petkov , David Kaplan , x86@kernel.org, luto@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] Revert "x86/retpoline: Remove .text..__x86.return_thunk section" Message-ID: <20231011223513.GH6307@noisy.programming.kicks-ass.net> References: <20231010171020.462211-1-david.kaplan@amd.com> <20231010171020.462211-2-david.kaplan@amd.com> <20231010174833.GG14330@noisy.programming.kicks-ass.net> <20231010195721.p5pb273kevg7ydxz@treble> <20231010200429.GIZSWuTWSUM9aId7a6@fat_crate.local> <20231010201912.7pjksbparssqu34k@treble> <20231010212254.ypk2wdogno55shit@treble> <20231011074142.GK14330@noisy.programming.kicks-ass.net> <20231011162843.grv6kixw4ides6uw@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231011162843.grv6kixw4ides6uw@treble> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 11 Oct 2023 15:36:05 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 11, 2023 at 09:28:43AM -0700, Josh Poimboeuf wrote: > On Wed, Oct 11, 2023 at 09:41:42AM +0200, Peter Zijlstra wrote: > > > +++ b/tools/objtool/check.c > > > @@ -1610,6 +1610,15 @@ static int add_jump_destinations(struct objtool_file *file) > > > return -1; > > > } > > > > > > + /* > > > + * Since retpolines are in the same section as the return > > > + * thunk, they might not use a relocation when branching to it. > > > + */ > > > + if (jump_dest->sym && jump_dest->sym->return_thunk) { > > > + add_return_call(file, insn, true); > > > + continue; > > > + } > > > > *urgh*... I mean, yes, that obviously works, but should we not also have > > the retpoline thingy for consistency? That case makes less sense though > > :/ > > Consistency with what? the reloc case; specifically, I was thinking something along these lines: if (jump-dest->sym && jump_dest->sym->retpoline_thunk) { add_retpoline_call(file, insn); continue; } Then both reloc and immediate versions are more or less the same. > The extra section seems pointless but maybe I'm missing something. By having the section things are better delineated I suppose, be it retpolines or rethunks, all references should be to inside the section (and thus have a reloc) while within the section there should never be a reference to itself. I'm not sure it's worth much, but then we can have the above two cases issue a WARN instead of fixing it up. I don't care too deeply, I can't make up my mind either way. But perhaps keeping the section is easier on all the backports, it's easy to forget a tiny objtool patch like this.