Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2193053iof; Tue, 7 Jun 2022 22:46:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzpiEpu9lxAq1+gKf38PrKiWgI7ct53rnYxUeVhlqRNHdWEOzC+mD8E7U60HGb3yz+g1x9 X-Received: by 2002:a17:902:e34b:b0:166:342f:82c6 with SMTP id p11-20020a170902e34b00b00166342f82c6mr31834439plc.29.1654667178027; Tue, 07 Jun 2022 22:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667178; cv=none; d=google.com; s=arc-20160816; b=wq8ZhsoWZLc2a0bxa10AmWXxujhaC3rFSiLY9MqfbeKR53VO613aWCSIr3rtbww9FT s6CcQmJnDIiTQ9RWzEuu5nUNLjDOOC8rhUfeFVehIxOy/aW3NajQJ7E6smf5n7I0Exr9 sJPZ6tm2PEf8+2AQryn0axUtWBmekOPr7tJYL9KO+UFotUZbnahPlC0+j0YhCXuxUo8e Vbcx8Ozd21G7fQfA1vVnqkOmKKTC4TYe7qCrJzN/h/hvWiYP+ZX8XM0GcYpy+MSVX9VJ CjEZwiokix9pGcFVbE2JyRJNozCQkNUgLTBmEIw/aE0hEAEotXJ8X9XU4my93hh6mjnx 6nDw== 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=1LwyUMFgW0mseBG/jgrLt0kUxkgXeqwa1YHDxiJW3lk=; b=Xxi/3kWPIIqTWtLwYXIKgl3yn9WJ//SWc+8OxdbBgTTHvFbKY3lKylMYMHokpC/kUi lEXLqv4ItZ06Gfz8PjIuduaG4X1X6M2M+f0GEWAh9S8cdtZZRPlohAIiN9i4+qp4k/UF T3qgAWzBCSdUjzQEs0Xr2hfz/qtjbf7QE7JLLH0OYKm1+PBtQLQO22MOGfvspA+AEU1N 7tvnQNmiEvjktq09a6BUw3o66sdhn6aMf5s/ZhaxJBgmmqYkRecONSzFqYwal8s3JWLX IosdmNaLelIjY18mgdVzUUUZP+86KnTCKsFijB+oKzIp3bGF6b0u5bVdJ+F9olSYVgjy oByQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qpoCk8WJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 71-20020a63014a000000b003f66d07b6e1si28525961pgb.721.2022.06.07.22.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qpoCk8WJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9BE034012F1; Tue, 7 Jun 2022 22:11:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382618AbiFHAYj (ORCPT + 99 others); Tue, 7 Jun 2022 20:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385141AbiFGWVB (ORCPT ); Tue, 7 Jun 2022 18:21:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F33265612; Tue, 7 Jun 2022 12:21:02 -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 sin.source.kernel.org (Postfix) with ESMTPS id D504ECE24B7; Tue, 7 Jun 2022 19:20:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDEEEC34115; Tue, 7 Jun 2022 19:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629652; bh=OcqvoIrpHGaxqSVYLx7xboNx4qStc91n6ZMjlVtDwLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qpoCk8WJdDJ4kh1TqffxOHoHDYoMyTqruGtp1wTtNqsjqqytp4JMSt9rFslQiJDG3 uWwogecWYA36Wqn+/XINFaParrUqAaSHz5XaLMvYIcasMA6RxIWkYcWthOVkDLQSEt s7XZlZ5edN7aOx+Cbv5mqQUfjWaPSd5/9wNZybn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , "Peter Zijlstra (Intel)" , Borislav Petkov Subject: [PATCH 5.18 717/879] objtool: Fix objtool regression on x32 systems Date: Tue, 7 Jun 2022 19:03:55 +0200 Message-Id: <20220607165023.666075498@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Mikulas Patocka commit 22682a07acc308ef78681572e19502ce8893c4d4 upstream. Commit c087c6e7b551 ("objtool: Fix type of reloc::addend") failed to appreciate cross building from ILP32 hosts, where 'int' == 'long' and the issue persists. As such, use s64/int64_t/Elf64_Sxword for this field and suffer the pain that is ISO C99 printf formats for it. Fixes: c087c6e7b551 ("objtool: Fix type of reloc::addend") Signed-off-by: Mikulas Patocka [peterz: reword changelog, s/long long/s64/] Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Cc: Link: https://lkml.kernel.org/r/alpine.LRH.2.02.2205161041260.11556@file01.intranet.prod.int.rdu2.redhat.com Signed-off-by: Greg Kroah-Hartman --- tools/objtool/check.c | 9 +++++---- tools/objtool/elf.c | 2 +- tools/objtool/include/objtool/elf.h | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -560,12 +561,12 @@ static int add_dead_ends(struct objtool_ else if (reloc->addend == reloc->sym->sec->sh.sh_size) { insn = find_last_insn(file, reloc->sym->sec); if (!insn) { - WARN("can't find unreachable insn at %s+0x%lx", + WARN("can't find unreachable insn at %s+0x%" PRIx64, reloc->sym->sec->name, reloc->addend); return -1; } } else { - WARN("can't find unreachable insn at %s+0x%lx", + WARN("can't find unreachable insn at %s+0x%" PRIx64, reloc->sym->sec->name, reloc->addend); return -1; } @@ -595,12 +596,12 @@ reachable: else if (reloc->addend == reloc->sym->sec->sh.sh_size) { insn = find_last_insn(file, reloc->sym->sec); if (!insn) { - WARN("can't find reachable insn at %s+0x%lx", + WARN("can't find reachable insn at %s+0x%" PRIx64, reloc->sym->sec->name, reloc->addend); return -1; } } else { - WARN("can't find reachable insn at %s+0x%lx", + WARN("can't find reachable insn at %s+0x%" PRIx64, reloc->sym->sec->name, reloc->addend); return -1; } --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -546,7 +546,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, long addend) + unsigned int type, struct symbol *sym, s64 addend) { struct reloc *reloc; --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -73,7 +73,7 @@ struct reloc { struct symbol *sym; unsigned long offset; unsigned int type; - long addend; + s64 addend; int idx; bool jump_table_start; }; @@ -135,7 +135,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, long addend); + unsigned int type, struct symbol *sym, s64 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);