diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/module.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/kernel/module.c b/kernel/module.c index 92112c91b7e..b99dcebc980 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1607,22 +1607,23 @@ static void set_section_ro_nx(void *base, | |||
1607 | } | 1607 | } |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | /* Setting memory back to RW+NX before releasing it */ | 1610 | /* Setting memory back to W+X before releasing it */ |
1611 | void unset_section_ro_nx(struct module *mod, void *module_region) | 1611 | void unset_section_ro_nx(struct module *mod, void *module_region) |
1612 | { | 1612 | { |
1613 | unsigned long total_pages; | ||
1614 | |||
1615 | if (mod->module_core == module_region) { | 1613 | if (mod->module_core == module_region) { |
1616 | /* Set core as NX+RW */ | 1614 | set_page_attributes(mod->module_core + mod->core_text_size, |
1617 | total_pages = MOD_NUMBER_OF_PAGES(mod->module_core, mod->core_size); | 1615 | mod->module_core + mod->core_size, |
1618 | set_memory_nx((unsigned long)mod->module_core, total_pages); | 1616 | set_memory_x); |
1619 | set_memory_rw((unsigned long)mod->module_core, total_pages); | 1617 | set_page_attributes(mod->module_core, |
1620 | 1618 | mod->module_core + mod->core_ro_size, | |
1619 | set_memory_rw); | ||
1621 | } else if (mod->module_init == module_region) { | 1620 | } else if (mod->module_init == module_region) { |
1622 | /* Set init as NX+RW */ | 1621 | set_page_attributes(mod->module_init + mod->init_text_size, |
1623 | total_pages = MOD_NUMBER_OF_PAGES(mod->module_init, mod->init_size); | 1622 | mod->module_init + mod->init_size, |
1624 | set_memory_nx((unsigned long)mod->module_init, total_pages); | 1623 | set_memory_x); |
1625 | set_memory_rw((unsigned long)mod->module_init, total_pages); | 1624 | set_page_attributes(mod->module_init, |
1625 | mod->module_init + mod->init_ro_size, | ||
1626 | set_memory_rw); | ||
1626 | } | 1627 | } |
1627 | } | 1628 | } |
1628 | 1629 | ||