module: switch to execmem API for remapping as RW and restoring ROX
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Sun, 26 Jan 2025 07:47:30 +0000 (09:47 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 3 Feb 2025 10:46:02 +0000 (11:46 +0100)
commitc287c072332905b7d878a8aade86cfef6b396343
tree2bab8c093bb09b271112c0c3b076917f3486b672
parent05e555b817262b5df6aa3a73df8b3dc9d388a3b4
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
include/linux/module.h
include/linux/moduleloader.h
kernel/module/main.c
kernel/module/strict_rwx.c