Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1515208ybg; Thu, 4 Jun 2020 11:37:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSY6Wi1jFBzM8nuhQ20BHlBvsJKT0YXIncHbhkKgadqS9B4vkgK+VFVS3H8YuqLv9TiMKJ X-Received: by 2002:a17:906:76c4:: with SMTP id q4mr5329333ejn.371.1591295843153; Thu, 04 Jun 2020 11:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591295843; cv=none; d=google.com; s=arc-20160816; b=U0WTv62ELwLB0re5s9xlBfC5a2Si4zD4GhF1vSHIo6NuYRl2XAPDlXUeL3UThWWxEy dD9wkdAGTxZBcirfMsEyjqlx/5aHnXtoKG8M2nqRrIeKmt2G+AJ5iaodzdJd9hHUapTQ QKkLXOi7LiOejqHVJSNYaZIdhEqC5gj/aZdMzvmCqNaf2DyQYDxwTXS0rG9wtIfuPF43 G6uoq1ET4k3eMaCXLt5qz2qG3lLRKMcTfJlnJkQkDGaWBn593vDjoSjIFdiVt7fSnVTP GM5nDas5KdTtA37tMJtcKCHlGusEQIZthhSZK1ztW2I88L/x/vIZwZY3i0x6h1B5sXlt yKQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Xlc3ln/i+zLhw22tYf5a9ufvTd4BE9KoUHibVgMsAWI=; b=jDhsF7QF4HGCQE06tS+Ht22d0fy6C1mY7yYCkYxSg5X6/qH9g/Rsa01nJCuH3+RfEH CoGRLJGTVAEt4+bstrkgar3cKNWmfxV1Iz/6bUfmSYWH8hATAXycS2Rn2G9gYL8uZKDe 0sZatzOZ+th1OOAcoD44FMW0OJTvGzDKqL3lGEaMiB+/ZvNBHqj5zMTQzL1O1m9t3ONm cNsFQQe7zMgNgOtBXrpG15EihpjVDpcqdt9TBje5swHeTHYVAGceugKTxrn359MAlcev +zxxk/Ur4Vqkm/mFNlzQlw/3LFgQV+Rr3DlxbCrAUwdAOlb7xmP88EETVUJWueSEEDpL 0YbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si2159073eja.684.2020.06.04.11.36.59; Thu, 04 Jun 2020 11:37:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728054AbgFDM4C (ORCPT + 99 others); Thu, 4 Jun 2020 08:56:02 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33338 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726003AbgFDM4C (ORCPT ); Thu, 4 Jun 2020 08:56:02 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C3FF38982D2650F15B66; Thu, 4 Jun 2020 20:55:57 +0800 (CST) Received: from [127.0.0.1] (10.166.212.204) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Thu, 4 Jun 2020 20:55:47 +0800 Subject: Re: [PATCH] module: make module symbols visible after init To: , CC: , , , , , References: <20200603141200.17745-1-cj.chengjian@huawei.com> From: "chengjian (D)" Message-ID: <14e1413f-92a2-f228-e149-82d4fdbc0c0d@huawei.com> Date: Thu, 4 Jun 2020 20:55:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200603141200.17745-1-cj.chengjian@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.166.212.204] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Petr, Jessica and Miroslav Thank you for your reply On 2020/6/4 16:57, Petr Mladek wrote: > On Wed 2020-06-03 14:12:00, Cheng Jian wrote: > > It is really handful that module symbols can be found already when > the module is MODULE_STATE_COMING state. It is used by livepatching, > ftrace, and maybe some other subsystems. Yes, you are right, I missed this before. There are many scenes that lookup the symbols of module when the module is MODULE_STATE_COMING state. in livepatch:     klp_module_coming -=> klp_write_object_relocations -=> klp_resolve_symbols -=> module_kallsyms_on_each_symbol My patch is incorrect. > The problem is that nobody is allowed to use (call) module symbols > before mod->init() is called and the module is moved to > MODULE_STATE_LIVE. > > By other words. Any code that calls module symbols before the module > is fully initialized is buggy. The caller should get fixed, > not the kallsyms side. > > Have you seen such a problem in the real life, please? > > Best Regards, > Petr > > .     Thank you very much.         -- Cheng Jian.