Received: by 10.213.65.68 with SMTP id h4csp427273imn; Tue, 13 Mar 2018 08:43:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELuoDr5qEOpg+h1Vy+iYSJJN3gCvmsqB9uSnJ3nT9B9EeHuAZ1TtfYNb/TEcmbBiXvelNStO X-Received: by 2002:a17:902:b418:: with SMTP id x24-v6mr979604plr.320.1520955821041; Tue, 13 Mar 2018 08:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520955820; cv=none; d=google.com; s=arc-20160816; b=0kDay+mV3pjSC8gepMgUuZwA+r0+QzjtSuQJTeFIfT/mIDkPzafsk2mCg1GRk6HUnD u35DB/wKOPzCylxG/i+K4M0wfF0dEG2YwjUjc0PFSW1B1PKNSfu9Dx3G1ZMGiD2EqKXy 9a1AxOGJqV1Mwptu5bmpdHq/Y8OPrduBCT6krlFB4zoZcVgLnzW+7+mDZhZvkxVM/9IS nUZvQFlx6MqZxpFU+DqVkvXjqvusI8tIFyZj1ImgeKl5KJiJXsn7bRGjqUOIWaauILeM z6Lrxw/YKJ0JkZyGShOBprOubVW7VxGtbkX8b8NQ150yhYhj9E3wkS31yEgzRclysoLu 7KfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VQ7YmJZQXI/9gReSLReHsKmpSQd7yJClCtzudeWt/us=; b=JxreJhojBt3aGkAKLkjRD3oMRykgbHWmplQFuH4SRSl6kODprlZ80L+W92Y2kO/2n5 pyoD2sS6ss+TOTYuqr01Ttuc/aXMzqm/dDw6IK4Z2h8iXbIUIjYEplrmPXkXOth/ObMO S730oR/l+byWNNgCodbDc1neXl9UrUPPfh6xATQHjZqHmUskQehT6LDoPb1/gjzvqkJ+ 8q5KsyyZb3MKOHoztux7cd2B1zVKV/+g59Wq3yYDKx/cM2kBTTONHZuuIRQJxVpSeS7o xQGOA+e9+FwaS78EnhPBSt5+YJIOkGmKAO+KWgXEz0Np0lpWHlzjERU8Q3H5xcNZtQFP Uu0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si255483pgs.685.2018.03.13.08.43.26; Tue, 13 Mar 2018 08:43:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964890AbeCMPl4 (ORCPT + 99 others); Tue, 13 Mar 2018 11:41:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37192 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964870AbeCMPlq (ORCPT ); Tue, 13 Mar 2018 11:41:46 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B39EB122C; Tue, 13 Mar 2018 15:41:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Joachim , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.14 139/140] objtool: Fix 32-bit build Date: Tue, 13 Mar 2018 16:25:42 +0100 Message-Id: <20180313152507.507725561@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josh Poimboeuf commit 63474dc4ac7ed3848a4786b9592dd061901f606d upstream. Fix the objtool build when cross-compiling a 64-bit kernel on a 32-bit host. This also simplifies read_retpoline_hints() a bit and makes its implementation similar to most of the other annotation reading functions. Reported-by: Sven Joachim Signed-off-by: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Fixes: b5bc2231b8ad ("objtool: Add retpoline validation") Link: http://lkml.kernel.org/r/2ca46c636c23aa9c9d57d53c75de4ee3ddf7a7df.1520380691.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- tools/objtool/check.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1115,42 +1115,29 @@ static int read_unwind_hints(struct objt static int read_retpoline_hints(struct objtool_file *file) { - struct section *sec, *relasec; + struct section *sec; struct instruction *insn; struct rela *rela; - int i; - sec = find_section_by_name(file->elf, ".discard.retpoline_safe"); + sec = find_section_by_name(file->elf, ".rela.discard.retpoline_safe"); if (!sec) return 0; - relasec = sec->rela; - if (!relasec) { - WARN("missing .rela.discard.retpoline_safe section"); - return -1; - } - - if (sec->len % sizeof(unsigned long)) { - WARN("retpoline_safe size mismatch: %d %ld", sec->len, sizeof(unsigned long)); - return -1; - } - - for (i = 0; i < sec->len / sizeof(unsigned long); i++) { - rela = find_rela_by_dest(sec, i * sizeof(unsigned long)); - if (!rela) { - WARN("can't find rela for retpoline_safe[%d]", i); + list_for_each_entry(rela, &sec->rela_list, list) { + if (rela->sym->type != STT_SECTION) { + WARN("unexpected relocation symbol type in %s", sec->name); return -1; } insn = find_insn(file, rela->sym->sec, rela->addend); if (!insn) { - WARN("can't find insn for retpoline_safe[%d]", i); + WARN("bad .discard.retpoline_safe entry"); return -1; } if (insn->type != INSN_JUMP_DYNAMIC && insn->type != INSN_CALL_DYNAMIC) { - WARN_FUNC("retpoline_safe hint not a indirect jump/call", + WARN_FUNC("retpoline_safe hint not an indirect jump/call", insn->sec, insn->offset); return -1; }