Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1270914pxb; Wed, 20 Oct 2021 01:32:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSd9NL/6mXyeWCnxw/AwhRe6keuxFCX0HR7tuOO/+GKUHAs9CXNLWHhlwanNZm12vK4beu X-Received: by 2002:a17:902:930c:b029:12c:d5c8:61c4 with SMTP id bc12-20020a170902930cb029012cd5c861c4mr37957723plb.73.1634718723184; Wed, 20 Oct 2021 01:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634718723; cv=none; d=google.com; s=arc-20160816; b=V552HkSIXVn+lhckaDvCEogw2DZiomrQJY46DB68ovJ8whNvHUAULjiZwv9NMcINdL +FvpMpD3wjrwFByP433yKBJ2+Pqzo/4UOtuO61nf+HfuD568yprFCa1y/0szHGMJ0wP3 IEC+2eIVIU9QbKCgcAucvbjY7y37SgDOpG4JFQhJ6cxyL1/HgI5JBozJ7dNamNK39Sbr G6k6CgqiMsQ5cYFpy2AoK+tSTs4S/NKPAwLv0oflpjwlNcXrDykDIC0FyV63ElEDgnyK SL6JLRLi0FROsHnPWykbevnXZGwFuH7paog95m6jTDfDCLbOMVZC5TEGc9nI1E88+RmO uH+g== 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=3OLZ7qJ08nHHBM2qZTVu1EJSQMFk9MZ440U4M+413G4=; b=i9Vb+qKfKSsLwsjOXfIvwg1mW4ZRSLpOTmKlBSXM/h35Rld6zgK6jiz9jbTV64Cg/m T33x5VEscCF3k8fcGHU5z7S+tO3Ra5eQwYG+FtC5Phe/dLM70dVBQB7QVD3x/zPgjfC4 LqZqyj6zJtoZGtld+CxWLH8qM7TigOVbRZVmqrM6zdNXYy3POWrvxW/bMC0XUMGKjFhm MaX7DJn6MiwEGK53FW3C0Ff8Qp74q5pPiE/9DXxof7C801BV3RfEzDJ7o+ldHkhVhxS0 fYq9Q0W1s6EyEP65l5KLt3wWLdI9sjmtS1IzfnsSPSRbU2IRj23LtnHA+ivMTJQaqudp iqHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=RGk1jGc8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si6357853pjt.139.2021.10.20.01.31.50; Wed, 20 Oct 2021 01:32:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=RGk1jGc8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229503AbhJTIdE (ORCPT + 99 others); Wed, 20 Oct 2021 04:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbhJTIdB (ORCPT ); Wed, 20 Oct 2021 04:33:01 -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 C9AF3C06161C for ; Wed, 20 Oct 2021 01:30:47 -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=3OLZ7qJ08nHHBM2qZTVu1EJSQMFk9MZ440U4M+413G4=; b=RGk1jGc8JOBaFeW4F07MM+J0W9 kq0fws2b1RIt1h60kYzTn4SBf2bSpGc6qk2s7+mVih9VllW+7Jd5Brth8UXAwaNTpl7iNTiyKnLI3 iunG+ayUMuZhBvAu9pP3MG9Mlxop1SL2C+Gk5eoSXVa370/sn8piAVYQWr13HFGYdJyhazfboiWTT pkgH2ZyabI9d0aY0/RSi/tyRpFm7lHOVte7HjXkCn1LS4Sa4BRPiVimNaux1vcLLsUPQaq2BF7UcD dh452jZWYp5ygNqHGJouW411Xx1gUari7A9ehMx+2kwZPV5Ob5lJbAjUEHiorOvFYw++WQrY/0vyH wVm3o7Zg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1md6ze-00AutD-EU; Wed, 20 Oct 2021 08:30:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 16597300221; Wed, 20 Oct 2021 10:30:38 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ECCA020F080E8; Wed, 20 Oct 2021 10:30:37 +0200 (CEST) Date: Wed, 20 Oct 2021 10:30:37 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, alexei.starovoitov@gmail.com, ndesaulniers@google.com Subject: Re: [PATCH 4/9] x86/alternative: Implement .retpoline_sites support Message-ID: References: <20211013122217.304265366@infradead.org> <20211013123645.002402102@infradead.org> <20211013205259.44cvvaxiexiff5w5@treble> <20211019164659.dybir4wgfmdt4r47@treble> <20211019164913.2dsyyethdeblqjlq@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019164913.2dsyyethdeblqjlq@treble> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 09:49:13AM -0700, Josh Poimboeuf wrote: > @@ -1087,9 +1109,7 @@ static int add_jump_destinations(struct objtool_file *file) > else > insn->type = INSN_JUMP_DYNAMIC_CONDITIONAL; > > - list_add_tail(&insn->call_node, > - &file->retpoline_call_list); > - > + add_call_dest(file, insn, reloc->sym, true); > insn->retpoline_safe = true; > continue; > } else if (insn->func) { > @@ -1218,20 +1238,14 @@ static int add_call_destinations(struct objtool_file *file) > > add_call_dest(file, insn, dest, false); > > - } else if (arch_is_retpoline(reloc->sym)) { > + } else if (reloc->sym->retpoline) { > /* > * Retpoline calls are really dynamic calls in > * disguise, so convert them accordingly. > */ > insn->type = INSN_CALL_DYNAMIC; > + add_call_dest(file, insn, reloc->sym, false); > insn->retpoline_safe = true; > - > - list_add_tail(&insn->call_node, > - &file->retpoline_call_list); > - > - remove_insn_ops(insn); > - continue; > - > } else > add_call_dest(file, insn, reloc->sym, false); > } So the problem with add_call_dest() like this, is that the instructions now get to have ->call_dest set, which is really strange for INSN_CALL_DYNAMIC etc.. At the very least it makes call_dest_name() misbehave. I've added add_retpoline_call() that also does the ->type frobbing and ->retpoline_safe marking instead.