[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190523102256.29168-4-ard.biesheuvel@arm.com>
Date: Thu, 23 May 2019 11:22:55 +0100
From: Ard Biesheuvel <ard.biesheuvel@....com>
To: linux-arm-kernel@...ts.infradead.org
Cc: marc.zyngier@....com, mark.rutland@....com,
linux-kernel@...r.kernel.org,
Ard Biesheuvel <ard.biesheuvel@....com>,
Nadav Amit <namit@...are.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Will Deacon <will.deacon@....com>,
Masami Hiramatsu <mhiramat@...nel.org>,
James Morse <james.morse@....com>
Subject: [PATCH 3/4] 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.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@....com>
---
arch/arm64/kernel/probes/kprobes.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c
index 2509fcb6d404..036cfbf9682a 100644
--- a/arch/arm64/kernel/probes/kprobes.c
+++ b/arch/arm64/kernel/probes/kprobes.c
@@ -131,8 +131,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;
}
--
2.17.1
Powered by blists - more mailing lists