]> Git Repo - linux.git/blobdiff - arch/powerpc/lib/code-patching.c
mm: remember exclusively mapped anonymous pages with PG_anon_exclusive
[linux.git] / arch / powerpc / lib / code-patching.c
index 906d4346336679eaf6b84765ad7d803b765a46ce..00c68e7fb11e4cd13b20c85c8783dd921168f86f 100644 (file)
@@ -43,9 +43,14 @@ int raw_patch_instruction(u32 *addr, ppc_inst_t instr)
 #ifdef CONFIG_STRICT_KERNEL_RWX
 static DEFINE_PER_CPU(struct vm_struct *, text_poke_area);
 
+static int map_patch_area(void *addr, unsigned long text_poke_addr);
+static void unmap_patch_area(unsigned long addr);
+
 static int text_area_cpu_up(unsigned int cpu)
 {
        struct vm_struct *area;
+       unsigned long addr;
+       int err;
 
        area = get_vm_area(PAGE_SIZE, VM_ALLOC);
        if (!area) {
@@ -53,6 +58,15 @@ static int text_area_cpu_up(unsigned int cpu)
                        cpu);
                return -1;
        }
+
+       // Map/unmap the area to ensure all page tables are pre-allocated
+       addr = (unsigned long)area->addr;
+       err = map_patch_area(empty_zero_page, addr);
+       if (err)
+               return err;
+
+       unmap_patch_area(addr);
+
        this_cpu_write(text_poke_area, area);
 
        return 0;
This page took 0.041414 seconds and 4 git commands to generate.