mirror of
https://github.com/torvalds/linux.git
synced 2026-01-24 23:16:46 +00:00
execmem: introduce execmem_alloc_rw()
Some callers of execmem_alloc() require the memory to be temporarily writable even when it is allocated from ROX cache. These callers use execemem_make_temp_rw() right after the call to execmem_alloc(). Wrap this sequence in execmem_alloc_rw() API. Link: https://lkml.kernel.org/r/20250713071730.4117334-3-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Petr Pavlu <petr.pavlu@suse.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org> Cc: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
fcd90ad31e
commit
838955f64a
@@ -1292,20 +1292,11 @@ static int module_memory_alloc(struct module *mod, enum mod_mem_type type)
|
||||
else
|
||||
execmem_type = EXECMEM_MODULE_TEXT;
|
||||
|
||||
ptr = execmem_alloc(execmem_type, size);
|
||||
ptr = execmem_alloc_rw(execmem_type, size);
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
if (execmem_is_rox(execmem_type)) {
|
||||
int err = execmem_make_temp_rw(ptr, size);
|
||||
|
||||
if (err) {
|
||||
execmem_free(ptr);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mod->mem[type].is_rox = true;
|
||||
}
|
||||
mod->mem[type].is_rox = execmem_is_rox(execmem_type);
|
||||
|
||||
/*
|
||||
* The pointer to these blocks of memory are stored on the module
|
||||
|
||||
Reference in New Issue
Block a user