All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Cheng Jian <cj.chengjian@huawei.com>
Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	chenwandun@huawei.com, xiexiuqi@huawei.com,
	bobo.shaobowang@huawei.com, huawei.libin@huawei.com,
	jeyu@kernel.org, jikos@kernel.org
Subject: Re: [PATCH] module: make module symbols visible after init
Date: Thu, 4 Jun 2020 10:57:12 +0200	[thread overview]
Message-ID: <20200604085712.GD22497@linux-b0ei> (raw)
In-Reply-To: <20200603141200.17745-1-cj.chengjian@huawei.com>

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

  parent reply	other threads:[~2020-06-04  8:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 14:12 [PATCH] module: make module symbols visible after init Cheng Jian
2020-06-03 17:00 ` Miroslav Benes
2020-06-04  9:49   ` Jessica Yu
2020-06-04  8:57 ` Petr Mladek [this message]
2020-06-04 12:55 ` chengjian (D)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604085712.GD22497@linux-b0ei \
    --to=pmladek@suse.com \
    --cc=bobo.shaobowang@huawei.com \
    --cc=chenwandun@huawei.com \
    --cc=cj.chengjian@huawei.com \
    --cc=huawei.libin@huawei.com \
    --cc=jeyu@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=xiexiuqi@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.