Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp136376iof; Sun, 5 Jun 2022 23:27:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyclYFWL0h1gmV3SrktVjLir7h4crJeaRG7i3ExViQGHhOW0HoGtDoOsggvykjhAJkP9THH X-Received: by 2002:a63:2a0c:0:b0:3fc:9b04:541d with SMTP id q12-20020a632a0c000000b003fc9b04541dmr20015964pgq.546.1654496840933; Sun, 05 Jun 2022 23:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654496840; cv=none; d=google.com; s=arc-20160816; b=gcaSfKDSiPdjIthTsxJmWDaZ4kO8lNUFWJ11mTg8zIXAAaekScLe6FuxQA6MvIqyJh XTQSAlY24NA9alcOYVE+F8zjnmCwVs1cB2JSx+pwNAK4tc5974MEN6r785ZBhBFv3xtn +AW/E612gvC0pWjSNBUw947fPmWYi+P5frC0c4PgHmib+fze9Xsu0SZDMHuzcfddh2hG OzVfoTP8cdBgrCAtxepdfNoV+yEqPgLKzm9sHU7CKGXdGXPPs35nGdLGtafykThw2BrP 75nIWcEPWW46YEl3y6wJmgc9gqVd5pRCBQjx/z909klfG715pa2KovyS0XkpFlK9KB36 sKeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=fe9PsgfIFxKcSrvbsk+3O4QEH1o6xyD9G98e0hlENu4=; b=dirBw+BE344yzPd2HA0DkQ8OA8QMSMJEFNkQ+kN4JfgsRRYnpZEXDCOFyYRaG61FUI wsvy2FJNtuUoRcvjuG6PLLragUxMVWIcDo9kvF68jYdf+3vlo/YIPq3hynaUWE8S/tul raomOZ+7Pa/5r56VdHyg4szYuNPTyj8UyEYBNuQJy7iyDLnS0WfU86aQ+ZsGpQH5kmfU 8g6QDjx/8z8vW67P6frRRmTmCFtKISnVILwboFSPZfpCvwgcsfBcpSe62Rhwtfuq+0fl RQ4VoEv1jVlehfbgDahy9Er/UABtjqIOtxWXF4IhOxTPNWdObaZsxF3P9taEiZQIIHIv o59A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=J4idJDLl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x14-20020a63170e000000b003fae900c345si18171940pgl.183.2022.06.05.23.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:27:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=J4idJDLl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 885D277F1F; Sun, 5 Jun 2022 22:31:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbiFFF3J (ORCPT + 99 others); Mon, 6 Jun 2022 01:29:09 -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: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 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 clocksource ISA agnostic") Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada --- drivers/clocksource/hyperv_timer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_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 = hv_read_reference_counter(); hv_setup_sched_clock(read_hv_sched_clock_msr); } -EXPORT_SYMBOL_GPL(hv_init_clocksource); -- 2.32.0