Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp899634rwd; Thu, 1 Jun 2023 08:00:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Ph3F2vseQX+fXvaNjtDdTnJSHPsnwfJp8loXa8wcFX08x0cgmZP7IexbtQNEl5T74bXcg X-Received: by 2002:a05:6a00:2344:b0:644:c365:50d5 with SMTP id j4-20020a056a00234400b00644c36550d5mr7746259pfj.6.1685631626248; Thu, 01 Jun 2023 08:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685631626; cv=none; d=google.com; s=arc-20160816; b=l0uU56bnQzxAY6xgRps7pKM6oYa5CrYslEXHlMc+r5t0bmcVBeAvbwHfvXY+TbLTMW fYINO0K9m4LZHtssmp7BLgs1p3DtNtWAnTihg6XZFIRgVTSxaKsguMxcXxiNo/YmjXwZ g1GHuVtmnnZbjHBIGbF3MGXwaztexbtF4xqgrrkQsUye86OyjizDPV3NorFKCTsWtnme MHRNYI7awBVvuC5LH81DIE5R9jW5d1VqBw+f8mSNHUX8hSh+m4HUpqFCmXDiXIqc/FzW HQIRnCYNrx21ziqjBah2fkOXIvHbdF8spcHMRxZ3Ktnwgi4sbgse3AAdKr43++eGMAma VzCg== 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=GQIBuYpBKLw4OZa0MugONgA2k/mjo2DJpbyLJmcp+l4=; b=K3br55VBkgNDVVnxGFdfO9gRlYVFgqE72IGVE1o43Kzg2MXRy0xQs2NNsuSyNRg3OU 3MAdefUSbveq9SyaGSImpT8cIWsfx3yF45LVBDmJbNxy4ssMMDdS6KdJot0ehBnUALGL ULXppoXpLXdysSciRXYg+jmgeArF/Js9l4vAKSg5QRLrSoqxr0znqX08JyhiXbIY3E8M o7246tlcjmswW2DbjSfX5g18+QoM/HGqMZS3B/JqcbfqsM4blrktVILETyA35eo0rAaE rfX95F6eE9I+Thnb34GCl+EsevoPRvyPochJKnR3wUjd13wn2YJ1DfHIvw1Gr50HkE+D kv+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LE40csoZ; 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 t1-20020a637801000000b0053f24deef14si2864295pgc.319.2023.06.01.08.00.13; Thu, 01 Jun 2023 08:00:26 -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=LE40csoZ; 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 S230252AbjFAOhU (ORCPT + 99 others); Thu, 1 Jun 2023 10:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233793AbjFAOg6 (ORCPT ); Thu, 1 Jun 2023 10:36:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBDCE7A; Thu, 1 Jun 2023 07:36:34 -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 12BDE645AE; Thu, 1 Jun 2023 14:36:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 766AFC433D2; Thu, 1 Jun 2023 14:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685630184; bh=q1nm3XJmvtIncOu+ub6wBefta37W073Fq2RfF3BrwDA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LE40csoZczJkWldp40THH+Zdkrug4V3qCiiGTMCHovAP5L53U7rCfGoH7brYaYPLu pTRgmznANKlibPSIjoOc3ePcv+AkSLvEVMmo/FOFoTuvkABUbt2wzvU0LhJbaTpyjR 8wdfk6GFIFQhzdvOJa3Kxwwzz22Y316Quw8oQpqbw4ipd4wfm+yNJNVFZe/eUIX0gO pr/hpnjSsK5wCd5ECoe4WviYL0qA9D2kItgny4/NOxbl1/lWlM93zGuQq/LBndfqsS 1ZyYaOW92/x4Rs5pHszq/9XGftSXTnv/h47DPhD34prD2ih8aUE6eWeHZZ9F2FPiaz x7d/oDSVI0SJA== Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-39810ce3e13so736485b6e.2; Thu, 01 Jun 2023 07:36:24 -0700 (PDT) X-Gm-Message-State: AC+VfDzfHNJzVLMjQ+LMGQIq6X4beW5hEeZ6V0uf/WBwxqydozoBhkNE T91+Jm2LN3bt35J8WBs5EK7KpqxhJvCjoTohFEo= X-Received: by 2002:a05:6808:150a:b0:398:34b9:5200 with SMTP id u10-20020a056808150a00b0039834b95200mr9477506oiw.51.1685630183791; Thu, 01 Jun 2023 07:36:23 -0700 (PDT) MIME-Version: 1.0 References: <20230601121001.1071533-1-masahiroy@kernel.org> <20230601121001.1071533-8-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Thu, 1 Jun 2023 23:35:47 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 7/7] modpost: detect section mismatch for R_ARM_REL32 To: Ard Biesheuvel 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, Jun 1, 2023 at 9:40=E2=80=AFPM Ard Biesheuvel wro= te: > > 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. 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. -- Best Regards Masahiro Yamada