Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp761739rwd; Thu, 1 Jun 2023 06:19:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5a/r0Rc83x1W7jptkp4bckV9CBI0LImu6RuN8zrbdD4R4lwmdqd6WGVI+rV7AYn7kgc2Ne X-Received: by 2002:a05:6a20:c1a0:b0:110:29dc:495e with SMTP id bg32-20020a056a20c1a000b0011029dc495emr9141252pzb.18.1685625593484; Thu, 01 Jun 2023 06:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685625593; cv=none; d=google.com; s=arc-20160816; b=E3lnKjgQJPnO2RTPDooLYy3qp80eyVAarcDSd4KyafOSUnMwv0kPifwyvZ5UT+uE2M KGmfVy4xpV+nKuhMsyeLg/nRRJz67z2LGOjJkFVHPsrfE5bskbDNsaMrzLi1FshQBSWv kuO6kepVZAXF2p0YeHpkk6kOAC0tAGEWy27ppEA+63klTjndT1jIU32fNIBJIab2XE0J AJOcn07nBFNZ9GoE8Ey9m2HFfNdAng2GbECr+S2tvxUuj2PiAxt7VXiPbNlrsQWpOaOK qT/CEnPxT8Ao3TGAM8tqvj36/PepdIkxvcQ1kCR2VRlfBb7Rvn7zmX8BszxVKA91naQk 4hRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=incJkIe/vASIw8Q2KL4L2e+WFe/jsAt35t8aLV89Dzk=; b=hwarXQ5KGAWU8kwx+h/Untj+1R+Q4jfrABKJaKmHOGkXHByBr08EsbCGDSJeeCnvDA 4QYy7Zsf2uMgP2Bf8YbQLbTmT0hrgTUtE7FFd6uoP7CNJvo8ifEskJIDFqhJF9IRganp PZUPH6Vdqiui5U4fCy6FZS2Pq+h1R+LOaB4IiZmxTPo1MkmVJWh+B53kI5GiNywi1zjV 638hy5hb/WKPh93YPvL1IrlbFljmxrPhl2gRevADmc60+JdF056bfxDioAFYXrA34hY1 Xepu2koLD4d/qc7viOIKe//z6Ii4Qrt8CrtAMru/4oZ4eqD8NtGIooWnSuxjE6Qiu4dV JbYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SOQ6df5z; 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 h9-20020aa796c9000000b0064fa153862fsi5357310pfq.113.2023.06.01.06.19.40; Thu, 01 Jun 2023 06:19:53 -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=SOQ6df5z; 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 S232994AbjFAMlD (ORCPT + 99 others); Thu, 1 Jun 2023 08:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjFAMk7 (ORCPT ); Thu, 1 Jun 2023 08:40:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A3A119; Thu, 1 Jun 2023 05:40:58 -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 5CD7D61D6D; Thu, 1 Jun 2023 12:40:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC4F6C433A0; Thu, 1 Jun 2023 12:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685623257; bh=LqVyTu0poYQlgNWSrPsLYLl1GkpkXrTVvv75F50j+3A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SOQ6df5z5IhuqVq6GVd1JcqkDc3OGMOfQLuYY6bjn8oiJtCO8aXdov0GJkBwEZszl wUGeZFUh1Xh1NcONJgtjpGnv4bAPFxyhbolTTnLXUeMh3mL5ZfO0wuRT0wV+9Vh2nI 0LEOjkoVmLpl0t94KvNUAsHWhmJiSr+aFs0GSFpqY267L6+pneKvi0TFo/E3U+mIk+ 6AThIBX9ysFnO5A7bgiVLxTURdN7ZUKBIX2t2EnHSMZhQVwI5sVoFcroD3z4pvQF+l Zf0MxbygpB8oAf5Oa8/W5o49Z+rXPqq5e/fWuvUekxH/mgpKN290fT78b3YN3p4xZu 3HIH6AKVgvgpA== Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2af2958db45so10910021fa.1; Thu, 01 Jun 2023 05:40:57 -0700 (PDT) X-Gm-Message-State: AC+VfDzrMMloEZm8yldKTA/ITpr8wIJFWSwewvotAJa/hkAAqD/8mhSW eVHwyEdrYRwmRZ6xpovpYU3vH3r71UDfVh0Z12Y= X-Received: by 2002:a2e:a305:0:b0:2ad:99dd:de07 with SMTP id l5-20020a2ea305000000b002ad99ddde07mr4917213lje.16.1685623255737; Thu, 01 Jun 2023 05:40:55 -0700 (PDT) MIME-Version: 1.0 References: <20230601121001.1071533-1-masahiroy@kernel.org> <20230601121001.1071533-8-masahiroy@kernel.org> In-Reply-To: <20230601121001.1071533-8-masahiroy@kernel.org> From: Ard Biesheuvel Date: Thu, 1 Jun 2023 14:40:44 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 7/7] modpost: detect section mismatch for R_ARM_REL32 To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 On Thu, 1 Jun 2023 at 14:10, Masahiro Yamada wrote: > > 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. OK, so the reason we can handle these in the same way is because we never calculate the resulting value, right? Because that value would be different for these cases. > > 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 >