Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1368560imi; Sat, 23 Jul 2022 03:53:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uBB3gj92wnzcd2K9MLlBkA1ZGkLXK0rGpTZb3MF9zo5/5slg5v0d2583TjscZms1uBJjhN X-Received: by 2002:a17:902:e790:b0:16d:27be:711c with SMTP id cp16-20020a170902e79000b0016d27be711cmr3669330plb.114.1658573638355; Sat, 23 Jul 2022 03:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658573638; cv=none; d=google.com; s=arc-20160816; b=afRWLc/YjHIiaVd1iFthujvLsX+L1roHd2EOZqIl3S78vrujET69r3zR8QmloT2Rdo TOYGu1JNBK06hpPsbNRbouwLpNtgRBKe7/ehaNDPqMGOzJgBgv1S4bbkYlvs9K6iBs0w kbBvYGqF1baRq33eoN86QUbeW3TKAidlTTdM3K1xosaqMbvkQo2A9Ff1V+3CFtHRdLuk mB9HM5Ri6hKww4srWm/1IGQSQGzwzTs+FSPEA3965ES5uaggyKAiPmgPPx1XnAAqsI7c vtLqZ6xgujBDiDrshQQu9uVVMcMfuptq6y6yjtCInpPHnio30FxZLsg9ZHUdCDE13+NH c1Xg== 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=ypbfYW99+I4t04U22Q+EtZCu6Qjct0IZ66ZaqUactH4=; b=wjD1qEJRN0iFGntgdmHnR+tR1BayPz+h+o4d51d5alrp+e94D3kXnlkwSD0w/XNv9x I1LfTsiKwA/jPhPToiSN6oIGpt7Yz9mzfC31B60ZUtqjL5RX94ZKKBI0SsTthDxmipYW xoSW/M2jBNyS9DW3Lf4BCIaPkhuZTZIYCaV7ECGbDDsudfOR9FOlQU0lggI1vIi/oMwr QnvKFOFX8pSPcIvTAXE9gyqpYze31hlxmH1aeOLKBJlDrKnDpJMTSWBLU2U+VRq7T6s1 g9WFyif0WKDc3FYuOXydlSYf750iucFx9OtIyywjaIUQxFnO5dYuO2YKIZZ5u6zAW9CP xqdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=17k6NY21; 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 e11-20020a170903240b00b0016252715440si196294plo.494.2022.07.23.03.53.43; Sat, 23 Jul 2022 03:53:58 -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=17k6NY21; 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 S238586AbiGWKGm (ORCPT + 99 others); Sat, 23 Jul 2022 06:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238438AbiGWKGX (ORCPT ); Sat, 23 Jul 2022 06:06:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6320EBE9D5; Sat, 23 Jul 2022 03:00:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3153CB82B92; Sat, 23 Jul 2022 10:00:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28A6CC341CB; Sat, 23 Jul 2022 10:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658570427; bh=mhfFvQtBEybVbqarS8ueWbYRtpojy7GFRiJPB7rBpNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=17k6NY21qXSisx3yneCWsyd3Ws7rvFYUsy05vRCRq0ZrqaLtY8vroGo/GD7e3WIFz 1miaWNV5meExgozjiqhzwI8hNimh3HTYTAdjgkXbWfHyzAy70DngEGU2bsn22rcPV7 8YlIZ8a705n/l9n26h3ROYT3pRjLjOUtbh0CqpbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Josh Poimboeuf , Ben Hutchings Subject: [PATCH 5.10 073/148] objtool: Fix type of reloc::addend Date: Sat, 23 Jul 2022 11:54:45 +0200 Message-Id: <20220723095244.628537805@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 c087c6e7b551b7f208c0b852304f044954cf2bb3 upstream. Elf{32,64}_Rela::r_addend is of type: Elf{32,64}_Sword, that means that our reloc::addend needs to be long or face tuncation issues when we do elf_rebuild_reloc_section(): - 107: 48 b8 00 00 00 00 00 00 00 00 movabs $0x0,%rax 109: R_X86_64_64 level4_kernel_pgt+0x80000067 + 107: 48 b8 00 00 00 00 00 00 00 00 movabs $0x0,%rax 109: R_X86_64_64 level4_kernel_pgt-0x7fffff99 Fixes: 627fce14809b ("objtool: Add ORC unwind table generation") Signed-off-by: Peter Zijlstra (Intel) Acked-by: Josh Poimboeuf Link: https://lkml.kernel.org/r/20220419203807.596871927@infradead.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- tools/objtool/check.c | 8 ++++---- tools/objtool/elf.c | 2 +- tools/objtool/elf.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -467,12 +467,12 @@ static int add_dead_ends(struct objtool_ else if (reloc->addend == reloc->sym->sec->len) { insn = find_last_insn(file, reloc->sym->sec); if (!insn) { - WARN("can't find unreachable insn at %s+0x%x", + WARN("can't find unreachable insn at %s+0x%lx", reloc->sym->sec->name, reloc->addend); return -1; } } else { - WARN("can't find unreachable insn at %s+0x%x", + WARN("can't find unreachable insn at %s+0x%lx", reloc->sym->sec->name, reloc->addend); return -1; } @@ -502,12 +502,12 @@ reachable: else if (reloc->addend == reloc->sym->sec->len) { insn = find_last_insn(file, reloc->sym->sec); if (!insn) { - WARN("can't find reachable insn at %s+0x%x", + WARN("can't find reachable insn at %s+0x%lx", reloc->sym->sec->name, reloc->addend); return -1; } } else { - WARN("can't find reachable insn at %s+0x%x", + WARN("can't find reachable insn at %s+0x%lx", reloc->sym->sec->name, reloc->addend); return -1; } --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -509,7 +509,7 @@ static struct section *elf_create_reloc_ int reltype); int elf_add_reloc(struct elf *elf, struct section *sec, unsigned long offset, - unsigned int type, struct symbol *sym, int addend) + unsigned int type, struct symbol *sym, long addend) { struct reloc *reloc; --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -73,7 +73,7 @@ struct reloc { struct symbol *sym; unsigned long offset; unsigned int type; - int addend; + long addend; int idx; bool jump_table_start; }; @@ -127,7 +127,7 @@ struct elf *elf_open_read(const char *na struct section *elf_create_section(struct elf *elf, const char *name, unsigned int sh_flags, size_t entsize, int nr); int elf_add_reloc(struct elf *elf, struct section *sec, unsigned long offset, - unsigned int type, struct symbol *sym, int addend); + unsigned int type, struct symbol *sym, long addend); int elf_add_reloc_to_insn(struct elf *elf, struct section *sec, unsigned long offset, unsigned int type, struct section *insn_sec, unsigned long insn_off);