From nobody Tue Apr 28 05:10:03 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82355C43334 for ; Mon, 6 Jun 2022 05:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbiFFF3K (ORCPT ); Mon, 6 Jun 2022 01:29:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbiFFF2R (ORCPT ); Mon, 6 Jun 2022 01:28:17 -0400 X-Greylist: delayed 167 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 05 Jun 2022 22:10:19 PDT Received: from condef-02.nifty.com (condef-02.nifty.com [202.248.20.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 390B513C1EE; Sun, 5 Jun 2022 22:10:18 -0700 (PDT) Received: from conuserg-09.nifty.com ([10.126.8.72])by condef-02.nifty.com with ESMTP id 256547AF021526; Mon, 6 Jun 2022 14:04:19 +0900 Received: from grover.sesame (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-09.nifty.com with ESMTP id 25652gOh011474; Mon, 6 Jun 2022 14:02:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 25652gOh011474 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1654491764; bh=fe9PsgfIFxKcSrvbsk+3O4QEH1o6xyD9G98e0hlENu4=; h=From:To:Cc:Subject:Date:From; b=J4idJDLliOL/8DeR5nGQQ2niDlZAIc3RakMevfSYF1S8fMMDf7vJXp/Kod69RdRBu pebb1wNXk2zWAyp6pjp0FCsor4vevekziwRM1BKBt283vZTSOOQA0B6W9zbFOYog/P IaKkq2XWMkrVdugNWkzXMtxkc3JgSeUFvieNwLy5VL/PWabzoc+yj+B0qbspiTzWGQ MS7+Jy/D+ymgiPz/0LlbBbLPG5l5E2TTUrSNfIRTrfb3H2xTTQ1oBL0N9CFQJGqCdL y1VFBCFOqgaOWSvaDzUg89R4VffE1o17U6tTlMB8iTXvyIXRFnF28ZlUMLByeU2HfA Uu3y5YIzO0zUg== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , linux-hyperv@vger.kernel.org Cc: Masahiro Yamada , Stephen Rothwell , Daniel Lezcano , Michael Kelley , Thomas Gleixner , Vitaly Kuznetsov , linux-kernel@vger.kernel.org Subject: [PATCH] clocksource: hyper-v: unexport __init-annotated hv_init_clocksource() Date: Mon, 6 Jun 2022 14:02:38 +0900 Message-Id: <20220606050238.4162200-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" EXPORT_SYMBOL and __init is a bad combination because the .init.text section is freed up after the initialization. Hence, modules cannot use symbols annotated __init. The access to a freed symbol may end up with kernel panic. modpost used to detect it, but it has been broken for a decade. Recently, I fixed modpost so it started to warn it again, then this showed up in linux-next builds. There are two ways to fix it: - Remove __init - Remove EXPORT_SYMBOL I chose the latter for this case because the only in-tree call-site, arch/x86/kernel/cpu/mshyperv.c is never compiled as modular. (CONFIG_HYPERVISOR_GUEST is boolean) Fixes: dd2cb348613b ("clocksource/drivers: Continue making Hyper-V clocksou= rce ISA agnostic") Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada Reviewed-by: Michael Kelley Reviewed-by: Vitaly Kuznetsov --- drivers/clocksource/hyperv_timer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyper= v_timer.c index ff188ab68496..bb47610bbd1c 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -565,4 +565,3 @@ void __init hv_init_clocksource(void) hv_sched_clock_offset =3D hv_read_reference_counter(); hv_setup_sched_clock(read_hv_sched_clock_msr); } -EXPORT_SYMBOL_GPL(hv_init_clocksource); --=20 2.32.0