From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C414C43617 for ; Thu, 1 Apr 2021 18:01:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7770260FF3 for ; Thu, 1 Apr 2021 18:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237422AbhDAR77 (ORCPT ); Thu, 1 Apr 2021 13:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236362AbhDARoZ (ORCPT ); Thu, 1 Apr 2021 13:44:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC86FC00F7E3; Thu, 1 Apr 2021 08:09:00 -0700 (PDT) Date: Thu, 01 Apr 2021 15:08:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1617289738; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4kgCcLri86FhOF+2Y2TFFFyOIxk3MfNp8ZWrrRHBOvU=; b=dJUnRosGMaHDoe9VnF+moAkfmHj/XyogWIyWuxMOoocGnT2qnEmVGForJe+47nGsayxQqr RDxA7EDI3nTp+En+lEti6z5cZlQ1JYGbB0UlsyxH8mEEuiYoTFp07NaUEwrjAnPez7sm0t lmrhuq8OTwdny5WgTXyw/vg6eCIbfVC7Pi5FCkZ0vDMPHKudVQeL35OvApIxhXbMxLRXM9 lXpu4tY89EmAlLnyN9avOrR+zlCJ9PEWpZzae8YoiXJhMuwZyB043xrsuIoAf5j0ph8NvN h0nulKbwwvwyOb/SSwseJBG4gegqb9WtO8V90Tqsi8fN+JP5MsXwaSh2IjqM4A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1617289738; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4kgCcLri86FhOF+2Y2TFFFyOIxk3MfNp8ZWrrRHBOvU=; b=/Oqm0HhbN1Wiygq3pr2itAyMbFe/J/Mbm+Ln+Ahlb5RiuNutHw2JuTIQHSIY04pNRlG66K sjldbv/XA/awA0Bg== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] objtool: Correctly handle retpoline thunk calls Cc: "Peter Zijlstra (Intel)" , Borislav Petkov , Miroslav Benes , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210326151259.567568238@infradead.org> References: <20210326151259.567568238@infradead.org> MIME-Version: 1.0 Message-ID: <161728973821.29796.14241839144918537341.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/core branch of tip: Commit-ID: db9d1dd670d7f3f146c654f289f20968af6a12de Gitweb: https://git.kernel.org/tip/db9d1dd670d7f3f146c654f289f20968af6a12de Author: Peter Zijlstra AuthorDate: Fri, 26 Mar 2021 16:12:03 +01:00 Committer: Borislav Petkov CommitterDate: Thu, 01 Apr 2021 11:34:01 +02:00 objtool: Correctly handle retpoline thunk calls Just like JMP handling, convert a direct CALL to a retpoline thunk into a retpoline safe indirect CALL. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Miroslav Benes Link: https://lkml.kernel.org/r/20210326151259.567568238@infradead.org --- tools/objtool/check.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index d45f018..519af4b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1025,6 +1025,18 @@ static int add_call_destinations(struct objtool_file *file) 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 accordingly. + */ + insn->type = INSN_CALL_DYNAMIC; + insn->retpoline_safe = true; + + remove_insn_ops(insn); + continue; + } else insn->call_dest = reloc->sym;