Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3595145imw; Thu, 7 Jul 2022 04:36:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLYLSmUxnxxeTpbB0s7qsoI/9h6XEOU2Bqjzkl/BERFM6fvCrNMsGfsbOCosXo3xx+yNeK X-Received: by 2002:a17:907:8a01:b0:726:2c8e:4cad with SMTP id sc1-20020a1709078a0100b007262c8e4cadmr43190775ejc.611.1657193773411; Thu, 07 Jul 2022 04:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657193773; cv=none; d=google.com; s=arc-20160816; b=b1DJBYwfM9SGvKM8Q9pV3QdmPxSZz/ENt2sna7dGFpIcOomcNdwqo+21Ws7gtrY478 mshgExo2ETGkvFSmBWTiD8QDNTTOgE5+tSjUK8t+ULz1CIDp/9YdXpXB0XAVdoHrBu29 FXbMWvcuiVUI6UG7jRDqCoe0T9bmf8bKcrAYKYVXoeagIIRl9k0VoN33OJLq6XSQMUbe 1K7xFn0ExxZvbmUEVhUs49FPAPDiiZgxwERM951SJVovNqBKFCUyzpl/4QRav8LlxzML J0h14wByS8vaOGun9C/Za+MmoE6fA6wnH0WyGTEwkkU+fzOXEMvSpeZfNRIPStWJa56K G9Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=WdDsGgKCnZgloHREPV5obeh4I0LDNnIh6+wLdGuGNeA=; b=S1hfWYQzbR8weSpj5F+EIOnn+22U4qGzgMFJz0pxf6Yh7vCBbaxj+Bq28BbyLp8H00 pPSIki5vN14wBUohsRSYCQ9dSPOlU6XttBD1MHpldwMJzPP+72IQBfaC6prrYyD8+BjY vuVDTjDEpU/IAHnqmQdTh/j7a2a1H/I3vKzM8uEZjLhQHLiBLP9fit22Zxd/OWiQMckq 89GYqx02hCgXpw3s48iP+aS5ClTSSV2BB0ORUTtEjLJduXczn8Tq8Pws0SVKP+TboPp2 VEc82PapJACs+rFZnUqcW2id1G9KiL9iqLl/QYYhVmHZQgXAwakKoV2FOgdN127G54Yt s/gg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fy12-20020a1709069f0c00b0072ab880b38esi3190764ejc.764.2022.07.07.04.35.43; Thu, 07 Jul 2022 04:36:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235204AbiGGLDR (ORCPT + 99 others); Thu, 7 Jul 2022 07:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234997AbiGGLDQ (ORCPT ); Thu, 7 Jul 2022 07:03:16 -0400 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73D6057224 for ; Thu, 7 Jul 2022 04:03:14 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Ldtmx1Fpdz9tCd; Thu, 7 Jul 2022 13:03:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id efQ1yoNuCuig; Thu, 7 Jul 2022 13:03:13 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Ldtmx0P46z9tCW; Thu, 7 Jul 2022 13:03:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F288D8B79F; Thu, 7 Jul 2022 13:03:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0jiyn1_nHucC; Thu, 7 Jul 2022 13:03:12 +0200 (CEST) Received: from [192.168.233.174] (unknown [192.168.233.174]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 89E5E8B768; Thu, 7 Jul 2022 13:03:12 +0200 (CEST) Message-ID: <95f35287-3d66-1788-e54c-7275fdba16ac@csgroup.eu> Date: Thu, 7 Jul 2022 13:03:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH/RFC] powerpc/module_64: allow .init_array constructors to run Content-Language: fr-FR To: Jan Stancek , mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, linuxppc-dev@lists.ozlabs.org, Wedson Almeida Filho Cc: linux-kernel@vger.kernel.org References: <920acea9aa18e4f2956581a8e158bdaa376fdf63.1629203945.git.jstancek@redhat.com> From: Christophe Leroy In-Reply-To: <920acea9aa18e4f2956581a8e158bdaa376fdf63.1629203945.git.jstancek@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 Le 17/08/2021 à 15:02, Jan Stancek a écrit : > gcov and kasan rely on compiler generated constructor code. > For modules, gcc-8 with gcov enabled generates .init_array section, > but on ppc64le it doesn't get executed. find_module_sections() never > finds .init_array section, because module_frob_arch_sections() renames > it to _init_array. > > Avoid renaming .init_array section, so do_mod_ctors() can use it. > > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Christophe Leroy > Signed-off-by: Jan Stancek Does commit d4be60fe66b7 ("powerpc/module_64: use module_init_section instead of patching names") fixes your issue ? If not, please rebase and resubmit. Thanks Christophe > --- > I wasn't able to trace the comment: > "We don't handle .init for the moment: rename to _init" > to original patch (it pre-dates .git). I'm not sure if it > still applies today, so I limited patch to .init_array. This > fixes gcov for modules for me on ppc64le 5.14.0-rc6. > > Renaming issue is also mentioned in kasan patches here: > https://patchwork.ozlabs.org/project/linuxppc-dev/cover/20210319144058.772525-1-dja@axtens > > arch/powerpc/kernel/module_64.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c > index 6baa676e7cb6..c604b13ea6bf 100644 > --- a/arch/powerpc/kernel/module_64.c > +++ b/arch/powerpc/kernel/module_64.c > @@ -299,8 +299,16 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr, > sechdrs[i].sh_size); > > /* We don't handle .init for the moment: rename to _init */ > - while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init"))) > + while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init"))) { > +#ifdef CONFIG_CONSTRUCTORS > + /* find_module_sections() needs .init_array intact */ > + if (strstr(secstrings + sechdrs[i].sh_name, > + ".init_array")) { > + break; > + } > +#endif > p[0] = '_'; > + } > > if (sechdrs[i].sh_type == SHT_SYMTAB) > dedotify((void *)hdr + sechdrs[i].sh_offset,