Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp891617rwd; Thu, 1 Jun 2023 07:53:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bKUYr0QF6mcXyJ31w7AlNJmNCyEGsEyaAKxXjla7M0Ig9HLoHLG66+sYapI+DFCgyT2H5 X-Received: by 2002:a05:6358:3421:b0:125:9a49:d879 with SMTP id h33-20020a056358342100b001259a49d879mr7861049rwd.20.1685631188271; Thu, 01 Jun 2023 07:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685631188; cv=none; d=google.com; s=arc-20160816; b=W+E9El209CqFPfheRcMk5G2ab+FxwIgHY07eynWw9reHIig31L00cKOnmjSZqGbC6B 3vMr3v/+SbPYjVwUV7s8tZB5KSi9QM8civM3YHNx6bNxcAOjO2/3wVr+ZeQifRNKiUkH FmDVJRnRtkyy4NSESFNdldinRot3AkOhaABjuLDT0PU9mQxkfDSwKDI86PqfPvU8nChs 2t0ifJkvgdw00uKYV4hoEDe8Tq9usU4UsbE95arbv7oc4nZeDy2YnmmkUqnbbPeMJT6h L0GJ0sSrKBBABM6G+vjjWeJdA8ZUxrMAhp+S8sZXe5JZXDoidPu9q4Hjo31qCaACLffB +xNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1mxScP2hfqlz5g+dyWJ8+FnvFmObS93ruDGPVxhRY6g=; b=obnYcrsP3+jUXbq+dIEGh89WnMI1KQXrehkR8BARfJgUzWncKBJPuvGebXhHA5W7Xj nephtmWunbMdmixJn0eC+jgR4WMyxAEvpxUYVVe2RLSEYzeVOuo3JGF/LxNGmvvcd38u XIU3B0HJ2WEZXrHBkHU/U5ENLE3+9NDWEo/w2uxwKXPnaism3NfjTwZoeDdTOEJSWDcM DEuP9dUPk2TjJ7+23eMyEd2kT/nPikTIKu7QnegYxq7QOAqlzxmbZ69TDo+zaAOXoo+G n89nulRkRHER2cDAvp6L/mihpKg1Wg5U7yIwI7gJFyBKQ9p6Kgpm8ewd3yMtcSx61eei gQZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nepBlgSu; 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 h18-20020a17090aa89200b00256c4209ba5si1173958pjq.158.2023.06.01.07.52.55; Thu, 01 Jun 2023 07:53:08 -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=nepBlgSu; 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 S234270AbjFAOlP (ORCPT + 99 others); Thu, 1 Jun 2023 10:41:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233470AbjFAOlN (ORCPT ); Thu, 1 Jun 2023 10:41:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1D7118C; Thu, 1 Jun 2023 07:41:08 -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 469AF64608; Thu, 1 Jun 2023 14:41:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3BD2C4339B; Thu, 1 Jun 2023 14:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685630467; bh=fKcNy26Ot13k/n7UuJGvVszN9Le6Ytdc+ch3JGpTnm0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nepBlgSuMwWPO8KXzxrAkpVSePJRt9d/4qLbEggBDOBVFe+Qf+dbJ2V0tVFbZgX5z wJ1FWiNARn80QP67yVBfhK6OWqAZWGC9uq2LhwP/fsp0ZDJ5nVCJA+MPqo4Q3q+yEt MLaMh4oM7AzCptfc4KtjPpQnKM23mMe+6N8ilwmCovQqnpADRrioKccuU9tJF37XN2 qxh9WD6+00XsViRh+hdojT1SuW8PHkngMkbCQXXiFUd9cT9gjP/BlE7PR4GXxvLqWy PsrigFITXBZ7ryu2zqNZee3AxvVKAmNAt05rFfGPldzZFWXFAvhsRBjNiZ6FjqTvJA sDEbf1RdnYHwg== Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2afb2875491so12142241fa.1; Thu, 01 Jun 2023 07:41:07 -0700 (PDT) X-Gm-Message-State: AC+VfDwnFL6dL20SPNFy/TPITnKXeu059kjNYWMJiY491NrB01KKFrol u5duAYIef+XK+kfwArHRRgTpT5xW3upDva3k3b4= X-Received: by 2002:a2e:7e04:0:b0:2af:231a:f9f0 with SMTP id z4-20020a2e7e04000000b002af231af9f0mr5136777ljc.42.1685630465613; Thu, 01 Jun 2023 07:41:05 -0700 (PDT) MIME-Version: 1.0 References: <20230601121001.1071533-1-masahiroy@kernel.org> <20230601121001.1071533-8-masahiroy@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Thu, 1 Jun 2023 16:40:54 +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" Content-Transfer-Encoding: quoted-printable 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 On Thu, 1 Jun 2023 at 16:36, Masahiro Yamada wrote: > > On Thu, Jun 1, 2023 at 9:40=E2=80=AFPM Ard Biesheuvel w= rote: > > > > On Thu, 1 Jun 2023 at 14:10, Masahiro Yamada wro= te: > > > > > > 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 anythin= g. > > > > > > 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. > > Right. > > '- loc' is unnecessary here because modpost never calculates the > resulting instruction. > > modpost wants to know the location of the referenced symbol. > (the offset from the start of the section). > > For the same reason, I omitted '- loc' for > PC-relative ones such as R_ARM_CALL, R_ARM_JUMP24, etc. > OK makes sense - I just wanted to double check