diff options
author | Ard Biesheuvel <ard.biesheuvel@arm.com> | 2019-05-23 11:22:55 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2019-06-24 18:10:39 +0100 |
commit | f83b4f8860046e0f5244eef35b25fc3e405d7fee (patch) | |
tree | 549e1a313e9ffb8aed756678796125d45ac7e21e /arch/arm64/kernel | |
parent | 4739d53fcd1df8a9f6f72bb02a3a1d852ad252b3 (diff) | |
download | linux-stable-f83b4f8860046e0f5244eef35b25fc3e405d7fee.tar.gz linux-stable-f83b4f8860046e0f5244eef35b25fc3e405d7fee.tar.bz2 linux-stable-f83b4f8860046e0f5244eef35b25fc3e405d7fee.zip |
arm64/kprobes: set VM_FLUSH_RESET_PERMS on kprobe instruction pages
In order to avoid transient inconsistencies where freed code pages
are remapped writable while stale TLB entries still exist on other
cores, mark the kprobes text pages with the VM_FLUSH_RESET_PERMS
attribute. This instructs the core vmalloc code not to defer the
TLB flush when this region is unmapped and returned to the page
allocator.
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r-- | arch/arm64/kernel/probes/kprobes.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index 88ce502c8e6f..bd5dfffca272 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -122,8 +122,10 @@ void *alloc_insn_page(void) void *page; page = vmalloc_exec(PAGE_SIZE); - if (page) + if (page) { set_memory_ro((unsigned long)page, 1); + set_vm_flush_reset_perms(page); + } return page; } |