Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8324577pxb; Fri, 19 Feb 2021 13:13:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwA5hYRbtXoO2fHH2xdBSvSLNSxvdb5DV6ehOO93CpOIEl9qNvCCEI2Kfl5oP082BZxP/l4 X-Received: by 2002:a17:906:28d0:: with SMTP id p16mr10025137ejd.124.1613769182719; Fri, 19 Feb 2021 13:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613769182; cv=none; d=google.com; s=arc-20160816; b=Vu06jMa92HKMIBPcH/DJ2tm8I1fSgr6EYFnd2TArasMVnHze5LSX/HgtXFeW2tAacR ZUAZ81f3/O8m3EUUzV7pyVI8PFlyVzcHxfa/hd3i0Ish70QZ5mEW6HA6SVgW74OTZCEr JkXJHg90YnaGqSUHHMkxm+uZg2EEKubZXmXlJ3P7KkiajKBodacdI7hZ1OrkbcAAqiE1 +VIS85voOzSdr1Bn3V6fu1/1W3mZPLFTIZ6whIMfHpoQiwLXbePnjS+WEef3LIn0KKKx USU+3tgQe6J1dSaQH8kX0bJXGmipsFKR+Am0CPdHdnEnDJ2hOdk3V6xOj9BP/1oo89D+ UeDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=RCK9xo44E8Hpqw0Fl1vlFmTzLi5iSPiPd8GaLzhg6dE=; b=vGX17EXuTzm1wgj2CKf3AFvg+GuD4/bGoHFwAvf7dKPqOAd2C6Abm/WjCNsdqvvXwb wWKXzexAZVEBl0Xvo5QlDu9/AbbpMcinU6T4j2yuY/+QTHy8RFBlkcyCqPorHb8zviBb nCovGYWnPN6rKCnBNycZUh3tWCl4LlqvK/3JkHSzpAZTH9QM6xxGkRN/WfImRI5qWCbv VmHNwUsy+PcmyGiC8TBOcawGQvp6cyTgKrhvXzXMBYhg0AOEPOAblfLLCQY/pPbsRCHJ pD1aRcEwVkpM4QuhxAS8Kamh7+GaPwcufdjjqDAzX+CXgDo6zTdni5VRrDjRF2QNOsam eBiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=SdjotqRZ; 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 b2si6698612ejk.68.2021.02.19.13.12.37; Fri, 19 Feb 2021 13:13:02 -0800 (PST) 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=merlin.20170209 header.b=SdjotqRZ; 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 S229746AbhBSVLA (ORCPT + 99 others); Fri, 19 Feb 2021 16:11:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbhBSVK4 (ORCPT ); Fri, 19 Feb 2021 16:10:56 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14BD6C06178A for ; Fri, 19 Feb 2021 13:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=RCK9xo44E8Hpqw0Fl1vlFmTzLi5iSPiPd8GaLzhg6dE=; b=SdjotqRZyA9SU6fT76oW0r+MB6 tpkwxVBgxAlLZfxw2yknrTSYrhJsFt1Efo4yfv5Gx9jpLrFml7dmn4YgxkoDe+yyW4zC6qjei+x45 97u5l+7ERImEExJ1/bY3qRA1RqatyIBoS4TYUUhYHpIkzqTz4zj14Xit6xHq7xRSHQXbeCy4usp4O YRS+pcegcxBmQOf6XsEF8q04mwPV/yyNZa6Q/AVHgZi9ihT8EZErjK1RG9D/jklTxsOsMN8LXAbL+ VSWo6TDZBi9j3UIqRiqGL12Lrx/7Wlg/am8mOVcUnOg760GkrCJvfD4lLY0KWJVhuzZWl0637wxjm xDqQbx6Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDD2N-0006Gb-U2; Fri, 19 Feb 2021 21:10:08 +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 5A93D305C10; Fri, 19 Feb 2021 22:10:05 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 412DF2021555C; Fri, 19 Feb 2021 22:10:05 +0100 (CET) Message-ID: <20210219210535.193010348@infradead.org> User-Agent: quilt/0.66 Date: Fri, 19 Feb 2021 21:43:01 +0100 From: Peter Zijlstra To: jpoimboe@redhat.com, x86@kernel.org, pjt@google.com, mbenes@suze.cz, jgross@suse.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org Subject: [RFC][PATCH 1/6] objtool: Correctly handle retpoline thunk calls References: <20210219204300.749932493@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just like JMP handling, convert a direct CALL to a retpoline thunk into a retpoline safe indirect CALL. Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/check.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -953,6 +953,18 @@ static int add_call_destinations(struct dest_off); return -1; } + + } else if (!strncmp(reloc->sym->name, "__x86_indirect_thunk_", 21)) { + /* + * Retpoline calls are really dynamic calls in + * disguise, so convert them accodingly. + */ + insn->type = INSN_CALL_DYNAMIC; + insn->retpoline_safe = true; + + remove_insn_ops(insn); + continue; + } else insn->call_dest = reloc->sym;