From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 21 Sep 2016 15:27:04 +0200 (CEST) Received: from localhost.localdomain ([127.0.0.1]:48616 "EHLO linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org with ESMTP id S23992096AbcIUN050SCG6 (ORCPT ); Wed, 21 Sep 2016 15:26:57 +0200 Received: from scotty.linux-mips.net (localhost.localdomain [127.0.0.1]) by scotty.linux-mips.net (8.15.2/8.14.8) with ESMTP id u8LDQuI3015683; Wed, 21 Sep 2016 15:26:56 +0200 Received: (from ralf@localhost) by scotty.linux-mips.net (8.15.2/8.15.2/Submit) id u8LDQuDv015682; Wed, 21 Sep 2016 15:26:56 +0200 Date: Wed, 21 Sep 2016 15:26:56 +0200 From: Ralf Baechle To: James Hogan Cc: Leonid Yegoshin , linux-mips@linux-mips.org Subject: Re: [PATCH 7/9] MIPS: uprobes: Flush icache via kernel address Message-ID: <20160921132656.GF14137@linux-mips.org> References: <0d915756776de050b8a92b5bb5d4e7ffbe784d66.1472747205.git-series.james.hogan@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0d915756776de050b8a92b5bb5d4e7ffbe784d66.1472747205.git-series.james.hogan@imgtec.com> User-Agent: Mutt/1.7.0 (2016-08-17) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 55221 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: ralf@linux-mips.org Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips On Thu, Sep 01, 2016 at 05:30:13PM +0100, James Hogan wrote: > 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 > Cc: Ralf Baechle > Cc: Leonid Yegoshin > Cc: linux-mips@linux-mips.org > --- > arch/mips/kernel/uprobes.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/arch/mips/kernel/uprobes.c b/arch/mips/kernel/uprobes.c > index 8452d933a645..9a507ab1ea38 100644 > --- a/arch/mips/kernel/uprobes.c > +++ b/arch/mips/kernel/uprobes.c > @@ -301,19 +301,14 @@ int set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, > void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, > void *src, unsigned long len) > { > - void *kaddr; > + void *kaddr, kstart; > > /* Initialize the slot */ > kaddr = kmap_atomic(page); > - memcpy(kaddr + (vaddr & ~PAGE_MASK), src, len); > + kstart = kaddr + (vaddr & ~PAGE_MASK); > + memcpy(kstart, src, len); > + flush_icache_range(kstart, kstart + len); > kunmap_atomic(kaddr); > - > - /* > - * The MIPS version of flush_icache_range will operate safely on > - * user space addresses and more importantly, it doesn't require a > - * VMA argument. > - */ > - flush_icache_range(vaddr, vaddr + len); I can't convince myself this is right wrt. to cache aliases ... Ralf