Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 301e97ff authored by Rusty Russell's avatar Rusty Russell Committed by Gerrit - the friendly Code Review server
Browse files

module: fix race in kallsyms resolution during module load success.



The kallsyms routines (module_symbol_name, lookup_module_* etc) disable
preemption to walk the modules rather than taking the module_mutex:
this is because they are used for symbol resolution during oopses.

This works because there are synchronize_sched() and synchronize_rcu()
in the unload and failure paths.  However, there's one case which doesn't
have that: the normal case where module loading succeeds, and we free
the init section.

We don't want a synchronize_rcu() there, because it would slow down
module loading: this bug was introduced in 2009 to speed module
loading in the first place.

Thus, we want to do the free in an RCU callback.  We do this in the
simplest possible way by allocating a new rcu_head: if we put it in
the module structure we'd have to worry about that getting freed.

Change-Id: I4b21a5f309cd5ff8005ec119f3e3f20eecee686b
Reported-by: default avatarRui Xiang <rui.xiang@huawei.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Git-commit: c749637909eea5d4090c6f50b89c2c20b534a280
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


[psodagud@codeaurora.org: resolved context conflicts in module.c]
Signed-off-by: default avatarPrasad Sodagudi <psodagud@codeaurora.org>
parent 5cbcbefd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment