|
@@ -52,6 +52,7 @@
|
|
|
#include <linux/ftrace.h>
|
|
|
#include <linux/frame.h>
|
|
|
#include <linux/kasan.h>
|
|
|
+#include <linux/moduleloader.h>
|
|
|
|
|
|
#include <asm/text-patching.h>
|
|
|
#include <asm/cacheflush.h>
|
|
@@ -417,6 +418,14 @@ static void prepare_boost(struct kprobe *p, struct insn *insn)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/* Recover page to RW mode before releasing it */
|
|
|
+void free_insn_page(void *page)
|
|
|
+{
|
|
|
+ set_memory_nx((unsigned long)page & PAGE_MASK, 1);
|
|
|
+ set_memory_rw((unsigned long)page & PAGE_MASK, 1);
|
|
|
+ module_memfree(page);
|
|
|
+}
|
|
|
+
|
|
|
static int arch_copy_kprobe(struct kprobe *p)
|
|
|
{
|
|
|
struct insn insn;
|