[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200604085712.GD22497@linux-b0ei>
Date: Thu, 4 Jun 2020 10:57:12 +0200
From: Petr Mladek <pmladek@...e.com>
To: Cheng Jian <cj.chengjian@...wei.com>
Cc: linux-kernel@...r.kernel.org, live-patching@...r.kernel.org,
chenwandun@...wei.com, xiexiuqi@...wei.com,
bobo.shaobowang@...wei.com, huawei.libin@...wei.com,
jeyu@...nel.org, jikos@...nel.org
Subject: Re: [PATCH] module: make module symbols visible after init
On Wed 2020-06-03 14:12:00, Cheng Jian wrote:
> When lookup the symbols of module by module_kallsyms_lookup_name(),
> the symbols address is visible only if the module's status isn't
> MODULE_STATE_UNFORMED, This is problematic.
>
> When complete_formation is done, the state of the module is modified
> to MODULE_STATE_COMING, and the symbol of module is visible to the
> outside.
>
> At this time, the init function of the module has not been called,
> so if the address of the function symbol has been found and called,
> it may cause some exceptions.
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.
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
Powered by blists - more mailing lists