Skip to content

Commit fcd90ad

Browse files
rpptakpm00
authored andcommitted
execmem: drop unused execmem_update_copy()
Patch series "x86: enable EXECMEM_ROX_CACHE for ftrace and kprobes", v3. These patches enable use of EXECMEM_ROX_CACHE for ftrace and kprobes allocations on x86. They also include some ground work in execmem. Since the execmem model for caching large ROX pages changed from the initial assumption that the memory that is allocated from ROX cache is always ROX to the current state where memory can be temporarily made RW and then restored to ROX, we can stop using text poking to update it. This also saves the hassle of trying lock text_mutex in execmem_cache_free() when kprobes already hold that mutex. This patch (of 8): The execmem_update_copy() that used text poking was required when memory allocated from ROX cache was always read-only. Since now its permissions can be switched to read-write there is no need in a function that updates memory with text poking. Remove it. Link: https://lkml.kernel.org/r/20250713071730.4117334-1-rppt@kernel.org Link: https://lkml.kernel.org/r/20250713071730.4117334-2-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Daniel Gomez <da.gomez@samsung.com> Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org> Cc: Petr Pavlu <petr.pavlu@suse.com> Cc: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 9bbffee commit fcd90ad

2 files changed

Lines changed: 0 additions & 18 deletions

File tree

include/linux/execmem.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,6 @@ DEFINE_FREE(execmem, void *, if (_T) execmem_free(_T));
185185
struct vm_struct *execmem_vmap(size_t size);
186186
#endif
187187

188-
/**
189-
* execmem_update_copy - copy an update to executable memory
190-
* @dst: destination address to update
191-
* @src: source address containing the data
192-
* @size: how many bytes of memory shold be copied
193-
*
194-
* Copy @size bytes from @src to @dst using text poking if the memory at
195-
* @dst is read-only.
196-
*
197-
* Return: a pointer to @dst or NULL on error
198-
*/
199-
void *execmem_update_copy(void *dst, const void *src, size_t size);
200-
201188
/**
202189
* execmem_is_rox - check if execmem is read-only
203190
* @type - the execmem type to check

mm/execmem.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,6 @@ void execmem_free(void *ptr)
399399
vfree(ptr);
400400
}
401401

402-
void *execmem_update_copy(void *dst, const void *src, size_t size)
403-
{
404-
return text_poke_copy(dst, src, size);
405-
}
406-
407402
bool execmem_is_rox(enum execmem_type type)
408403
{
409404
return !!(execmem_info->ranges[type].flags & EXECMEM_ROX_CACHE);

0 commit comments

Comments
 (0)