Received: by 10.213.65.68 with SMTP id h4csp452195imn; Tue, 13 Mar 2018 09:29:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELtMVFQuJpyotqyFPn1+pRrzKod61PyBfHs2z4IyzzyCbMPNol4Ac6NOPT4VT0a9HSpNgojQ X-Received: by 2002:a17:902:858c:: with SMTP id e12-v6mr1109618plo.39.1520958583573; Tue, 13 Mar 2018 09:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520958583; cv=none; d=google.com; s=arc-20160816; b=FjBGbou7ZiOUQlrIUB1b8YnSeltcExnxzTqoLnQEh/WOAMIprbKaWxvFb3J6BNp1fU NwIUoPlZw1p8prdvjxLY9jIomvw248Udd8U/TKpltupyLnjQgrB5QmBHSwoRRsWUxthb Sllmiqxsm8mCYLqtQPP5cgJOPoP+D0FIlo2rI9v/L9klHMNU11aD3phsRPYa1SZqirAs fh3P4BcMlqhNK4+GXWUgHB69zdTw6EbbRYptbKfLp1ecNgmok7Yuk1wb+BmiH31T+LG+ RNrKpbTzx5WLlO3vvd8oqfCrlN1mH/lkIbJY96I2DQlHhQ/sTTOQKuKfG4y8AbL/pBLU e/Tw== 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=yl8VZ4sY+5/BXnxtAhsnMs2pKS4007E2ZL0CD7gPI6E=; b=QFh9sr47n4aoyyGjjBlWyhlTNaoRC44Ls3Vus57LpUEZ9WTVF3RL+u+6mqBZ97kkGx fx8r653LX1FrY6biPf3KXPQMh6cEffdBKc7QMEnhQdx2htNhDnQ2F9VPP/aBRcL353MA f6uAANrIM38spUnME+cQuRndAFjUEfp+1U7104jtDLyPE9e+zRSS220mMW/adrakiC4C szGmyjePUMVgVkB3sHrjhvBl2L1B2F0ltnvANP9VZT6SnIvrVeZa8l3J4lJh8bUokfrd i43A6NYkOAd2y/6ZxDR7CFO2ztGyQgtc1yZx3Y7ODzolPKr5m5PWdIBCTKfcLo9HLcXX QiCA== 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 z3si284988pgp.788.2018.03.13.09.29.29; Tue, 13 Mar 2018 09:29:43 -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 S933647AbeCMQ1w (ORCPT + 99 others); Tue, 13 Mar 2018 12:27:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60736 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933544AbeCMPde (ORCPT ); Tue, 13 Mar 2018 11:33:34 -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 6A905E64; Tue, 13 Mar 2018 15:33:33 +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.15 102/146] objtool: Fix 32-bit build Date: Tue, 13 Mar 2018 16:24:29 +0100 Message-Id: <20180313152328.377728392@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@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.15-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; }