summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/probes
diff options
context:
space:
mode:
authorJisheng Zhang <jszhang@kernel.org>2021-03-29 20:24:21 +0200
committerPalmer Dabbelt <palmerdabbelt@google.com>2021-04-26 17:25:11 +0200
commitcdd1b2bd358ffda2638fe18ff47191e84e18525f (patch)
tree085cee5bcf1449b889da7d91fcd83fccdbbd7e6e /arch/riscv/kernel/probes
parentriscv: Constify sbi_ipi_ops (diff)
downloadlinux-cdd1b2bd358ffda2638fe18ff47191e84e18525f.tar.xz
linux-cdd1b2bd358ffda2638fe18ff47191e84e18525f.zip
riscv: kprobes: Implement alloc_insn_page()
Allocate PAGE_KERNEL_READ_EXEC(read only, executable) page for kprobes insn page. This is to prepare for STRICT_MODULE_RWX. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/kernel/probes')
-rw-r--r--arch/riscv/kernel/probes/kprobes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c
index a2ec18662fee..0b451ff76d55 100644
--- a/arch/riscv/kernel/probes/kprobes.c
+++ b/arch/riscv/kernel/probes/kprobes.c
@@ -84,6 +84,14 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
return 0;
}
+void *alloc_insn_page(void)
+{
+ return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END,
+ GFP_KERNEL, PAGE_KERNEL_READ_EXEC,
+ VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
+ __builtin_return_address(0));
+}
+
/* install breakpoint in text */
void __kprobes arch_arm_kprobe(struct kprobe *p)
{