Commit ae92ef8a authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] flush icache in correct context

flush_icache_range() is used in two different situation - in binfmt_elf.c &
co for user space mappings and module.c for kernel modules.  On m68k
flush_icache_range() doesn't know which data to flush, as it has separate
address spaces and the pointer argument can be valid in either address
space.

First I considered splitting flush_icache_range(), but this patch is
simpler.  Setting the correct context gives flush_icache_range() enough
information to flush the correct data.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f5073456
...@@ -1758,6 +1758,7 @@ sys_init_module(void __user *umod, ...@@ -1758,6 +1758,7 @@ sys_init_module(void __user *umod,
const char __user *uargs) const char __user *uargs)
{ {
struct module *mod; struct module *mod;
mm_segment_t old_fs = get_fs();
int ret = 0; int ret = 0;
/* Must have permission */ /* Must have permission */
...@@ -1775,6 +1776,9 @@ sys_init_module(void __user *umod, ...@@ -1775,6 +1776,9 @@ sys_init_module(void __user *umod,
return PTR_ERR(mod); return PTR_ERR(mod);
} }
/* flush the icache in correct context */
set_fs(KERNEL_DS);
/* Flush the instruction cache, since we've played with text */ /* Flush the instruction cache, since we've played with text */
if (mod->module_init) if (mod->module_init)
flush_icache_range((unsigned long)mod->module_init, flush_icache_range((unsigned long)mod->module_init,
...@@ -1783,6 +1787,8 @@ sys_init_module(void __user *umod, ...@@ -1783,6 +1787,8 @@ sys_init_module(void __user *umod,
flush_icache_range((unsigned long)mod->module_core, flush_icache_range((unsigned long)mod->module_core,
(unsigned long)mod->module_core + mod->core_size); (unsigned long)mod->module_core + mod->core_size);
set_fs(old_fs);
/* Now sew it into the lists. They won't access us, since /* Now sew it into the lists. They won't access us, since
strong_try_module_get() will fail. */ strong_try_module_get() will fail. */
stop_machine_run(__link_module, mod, NR_CPUS); stop_machine_run(__link_module, mod, NR_CPUS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment