Skip to content

Commit d99a043

Browse files
James Hoganralfbaechle
authored andcommitted
MIPS: uprobes: Flush icache via kernel address
Update arch_uprobe_copy_ixol() to use the kmap_atomic() based kernel address to flush the icache with flush_icache_range(), rather than the user mapping. We have the kernel mapping available anyway and this avoids having to switch to using the new __flush_icache_user_range() for the sake of Enhanced Virtual Addressing (EVA) where flush_icache_range() will become ineffective on user addresses. Signed-off-by: James Hogan <[email protected]> Cc: Leonid Yegoshin <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/14154/ Patchwork: https://patchwork.linux-mips.org/patch/14308/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent 8e3a9f4 commit d99a043

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

arch/mips/kernel/uprobes.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,19 +282,14 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm,
282282
void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
283283
void *src, unsigned long len)
284284
{
285-
void *kaddr;
285+
unsigned long kaddr, kstart;
286286

287287
/* Initialize the slot */
288-
kaddr = kmap_atomic(page);
289-
memcpy(kaddr + (vaddr & ~PAGE_MASK), src, len);
290-
kunmap_atomic(kaddr);
291-
292-
/*
293-
* The MIPS version of flush_icache_range will operate safely on
294-
* user space addresses and more importantly, it doesn't require a
295-
* VMA argument.
296-
*/
297-
flush_icache_range(vaddr, vaddr + len);
288+
kaddr = (unsigned long)kmap_atomic(page);
289+
kstart = kaddr + (vaddr & ~PAGE_MASK);
290+
memcpy((void *)kstart, src, len);
291+
flush_icache_range(kstart, kstart + len);
292+
kunmap_atomic((void *)kaddr);
298293
}
299294

300295
/**

0 commit comments

Comments
 (0)