mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
module: switch to execmem API for remapping as RW and restoring ROX
Instead of using writable copy for module text sections, temporarily remap the memory allocated from execmem's ROX cache as writable and restore its ROX permissions after the module is formed. This will allow removing nasty games with writable copy in alternatives patching on x86. Signed-off-by: "Mike Rapoport (Microsoft)" <rppt@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250126074733.1384926-7-rppt@kernel.org
This commit is contained in:
committed by
Peter Zijlstra
parent
05e555b817
commit
c287c07233
@@ -367,7 +367,6 @@ enum mod_mem_type {
|
||||
|
||||
struct module_memory {
|
||||
void *base;
|
||||
void *rw_copy;
|
||||
bool is_rox;
|
||||
unsigned int size;
|
||||
|
||||
@@ -769,14 +768,9 @@ static inline bool is_livepatch_module(struct module *mod)
|
||||
|
||||
void set_module_sig_enforced(void);
|
||||
|
||||
void *__module_writable_address(struct module *mod, void *loc);
|
||||
|
||||
static inline void *module_writable_address(struct module *mod, void *loc)
|
||||
{
|
||||
if (!IS_ENABLED(CONFIG_ARCH_HAS_EXECMEM_ROX) || !mod ||
|
||||
mod->state != MODULE_STATE_UNFORMED)
|
||||
return loc;
|
||||
return __module_writable_address(mod, loc);
|
||||
return loc;
|
||||
}
|
||||
|
||||
#else /* !CONFIG_MODULES... */
|
||||
|
||||
Reference in New Issue
Block a user