Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp663826rwd; Thu, 1 Jun 2023 05:13:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6je1+FVwtVIMuKzp4OWuCRJTsTfpj7Nu7/zpSFFd5XmiccQ7JzwVYFfTZdJZc5CxCmbo2+ X-Received: by 2002:a17:902:9b8f:b0:1b1:9d43:ad4c with SMTP id y15-20020a1709029b8f00b001b19d43ad4cmr690144plp.40.1685621598910; Thu, 01 Jun 2023 05:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685621598; cv=none; d=google.com; s=arc-20160816; b=rqye0jdQk4H+JHE6sl3MltzM5koc6VxYKH5IroOlPLvU/bh5/DKtVxlfMUUSHT//go dC/JqUaOHIv9qtRB0n3S1lbnVJ5AAxloqsk2av90S6/sVktOSJpIfWAxwpVJhAIcSJON DCjFPXX48ZP+qLGppkzDq94flQFWAQjqoOc5M2u/h05hl4D0zTD466z8tarMHMOiIElU SPojjecTPNVvNrhrMOdMbZI7EyU48j7wyGWQ4QfnWii/t73GdBlIIg6KnXfPHbvphUk9 CXBHeonUOdLGuDJ+GHYMWZCBlSiFKGRY89q/Bxx3ZN3NQYbtHLMZRuVEnbs/SlbmQ0ax UTMg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=il7LD4+xBXxX0/9FrnLKW/4wqN0RtYA+SprkFoGDivM=; b=CqijaOtG8WygBSXv9bR1kOhtmCcTzwZd5hs3RVCJSII/PjwgTladv1zYhLKwJzSUzJ dlsq3++MHLmVohtXdA91E+ICQN0soFlmcKwLfYib5bnz4iJjGW1a527/lioPIG+Q3r53 k3gZkhAwTec3vC3omhhdodHCE1N/rnI2y1BnJiRaoofo05Lvz+aNcjs4bpyeUQ2quxFY jIepGxSdeLsxpKFnjwh8K8+MVL0XKRGkzF4e7Ne1VWJCDqz0JTkrNDjzkCqtwZLDUF3Z 4QxL/5Y9CFwg7P5kHeJ0lUVFz8qsiXsPtslwKY5euTx+MLhexkS8gSH5OSexgefOrGDv VW/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SbJwf4gm; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a1709027c1800b001ae3214162dsi367337pll.548.2023.06.01.05.13.07; Thu, 01 Jun 2023 05:13:18 -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=@kernel.org header.s=k20201202 header.b=SbJwf4gm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232877AbjFAMLd (ORCPT + 99 others); Thu, 1 Jun 2023 08:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233293AbjFAMKt (ORCPT ); Thu, 1 Jun 2023 08:10:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A8DEE50; Thu, 1 Jun 2023 05:10:37 -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 282C2641A9; Thu, 1 Jun 2023 12:10:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1781C433A0; Thu, 1 Jun 2023 12:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685621436; bh=eMacqv00K8bJeMNK92sV1H4jFGoCI1e91wlVYvSCA6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SbJwf4gmpXiXBcoZnqcOtwMctCfgu2govvYcmytWmux8JMSq+1RHR2N8rpx5KZ6UF 61/5EPxVCs0pxoO+Cl7pnYYQdM5MLEND+6FtFQW07RgnQDL0wPPTjpytv2U9+o3u8w K4m/fy0y5W+ZffGmTazVcbnRCHk9hfC5uNOrOXXL/rGv+WrlFRPr8bYFK2Egu7vrnv rNqA92cuyyZ30DO+n2qxlQyMyzhdXr0tjpdf4DSQRxxMiU0SZnqzhYibEkuE+Lg+I1 rTiYQDHSJiFa+EobEK9N1ZeM2SvTguMeOX45UOjKaIc11CEEFiA9L7TA7Bp8rBJed+ Inyd6OuukOmzw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, Russell King , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 7/7] modpost: detect section mismatch for R_ARM_REL32 Date: Thu, 1 Jun 2023 21:10:01 +0900 Message-Id: <20230601121001.1071533-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601121001.1071533-1-masahiroy@kernel.org> References: <20230601121001.1071533-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 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,T_SCC_BODY_TEXT_LINE 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 For ARM, modpost fails to detect some types of section mismatches. [test code] .section .init.data,"aw" bar: .long 0 .section .data,"aw" .globl foo foo: .long bar - . It is apparently a bad reference, but modpost does not report anything. The test code above produces the following relocations. Relocation section '.rel.data' at offset 0xe8 contains 1 entry: Offset Info Type Sym.Value Sym. Name 00000000 00000403 R_ARM_REL32 00000000 .init.data Currently, R_ARM_REL32 is just skipped. Handle it like R_ARM_ABS32. Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 55d142bb000b..9f0c87064ca5 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1281,6 +1281,7 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) switch (r_typ) { case R_ARM_ABS32: + case R_ARM_REL32: inst = TO_NATIVE(*(uint32_t *)loc); r->r_addend = inst + sym->st_value; break; -- 2.39.2