Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1369611imi; Sat, 23 Jul 2022 03:56:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t49md7TUriwo/cOikKdS61Qc0redjVzBmXnH+sqhRIt/loo3m+0VamQvxQHMKJ+y1WEIwa X-Received: by 2002:a17:907:75f5:b0:72b:40da:a7cd with SMTP id jz21-20020a17090775f500b0072b40daa7cdmr3075446ejc.662.1658573784501; Sat, 23 Jul 2022 03:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658573784; cv=none; d=google.com; s=arc-20160816; b=p8Lw38UirE5mL741eNA8jd58LyYyB2yRzn4R4nEj0hVyus2Uj+ONxx1/PvmUtNUO+x 0SSzU3i099dgDkeCtjNFPFPPNqswg6PIpewyKmqKNnh7Ff958TwWQ24bpTzKEzkX3hW3 2gFjzU77ktDNuuIn5Yhnqn7HHkECLzyJsuH9HWAGxG6mU5sPzpYF8FeUHEEoBFS45LxJ oyFJC6cUweiStmFpZ9EyZMwUEk0SjiIqlof+/OBCWLV4thRLhWpbQ2fkG9YJr1+lG73R dAyQb4KvNKuDnOE5LZBET6bSD5GCFk2jDMRnvin/kmfbLYrs8BQ8j7r7G/dnQesEE/Gw FeqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z6hOlCeKz7fUzThNCaFI8eCRDRDDVgudlFmabuRsuxI=; b=GAdP4QT5Xfa7wAttswoDTnYelMZEKCf1ZvoIdu+KWp/F3lxL2yGDdxzgJwrubduqHa qy8aIJ602NRhK/zgO5XtgfS5ibgrJYlzB+QGSQO4z3G+w58NptI4QkYWG0EwoYIqUoP2 Fz7zTiG3pRT4cg46SpIx1QuvAjLrapPkcA91gljoCjrgBx29QYawb+1jBiOFqzQLolzP u0T3FWW57Wa1rLPjQ415o1cbwZeo2NbWVtPGw3wF96sG2Uov0g7UO+IkNOqIMbTw/Wr+ 07fWhsbsLJTHdqulm5Axw6XsHI77Ght4+xklKwhmdjE200ast9yYbfhjkmnV5ShBUJF2 tC1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UcaF+rmW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di17-20020a170906731100b0072f09e7093fsi8941595ejc.141.2022.07.23.03.55.59; Sat, 23 Jul 2022 03:56:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UcaF+rmW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237878AbiGWKAV (ORCPT + 99 others); Sat, 23 Jul 2022 06:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237777AbiGWJ7g (ORCPT ); Sat, 23 Jul 2022 05:59:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0747F70E54; Sat, 23 Jul 2022 02:58:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AEDB611BD; Sat, 23 Jul 2022 09:58:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B677C341C0; Sat, 23 Jul 2022 09:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658570284; bh=lsyuTmXLAidtYPc/lopZFL7NAHk8kmzndFF44qwQcAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcaF+rmWykXZEH6L6JVTuoUWExanRUCO//olGC9XPWulS4DiBWhvvt9uqid0c5Cq2 f+NNSGaGqJxhpa41aNCFg5o81Ham4Y0WBA1qB7s23LCbBRAXUSjDiVLETAN2F1ITqx bE3Z81IM/cLoNpZfy2cmb8gqZzSFFwCGJ2oivJB4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Borislav Petkov , Ingo Molnar , Miroslav Benes , Ben Hutchings Subject: [PATCH 5.10 023/148] objtool: Correctly handle retpoline thunk calls Date: Sat, 23 Jul 2022 11:53:55 +0200 Message-Id: <20220723095230.917495578@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220723095224.302504400@linuxfoundation.org> References: <20220723095224.302504400@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra commit bcb1b6ff39da7e8a6a986eb08126fba2b5e13c32 upstream. 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 Signed-off-by: Ingo Molnar Reviewed-by: Miroslav Benes Link: https://lkml.kernel.org/r/20210326151259.567568238@infradead.org Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- 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 accordingly. + */ + insn->type = INSN_CALL_DYNAMIC; + insn->retpoline_safe = true; + + remove_insn_ops(insn); + continue; + } else insn->call_dest = reloc->sym;