From patchwork Wed Apr 16 20:24:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 28503 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2CC172036A for ; Wed, 16 Apr 2014 20:26:22 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id n16sf60652798oag.5 for ; Wed, 16 Apr 2014 13:26:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:subject:references:in-reply-to:cc:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=tETMbN58AzpC6KIqZV+EPOLchFKvCuJ6JJeFnhe8PIU=; b=cKZ5AHpXteVeKgqaPDh6k2Hhn77Ijsvcp3v42Ye8XbnrL4FsQpt/bHOZacTc5qzNgO B2Y4Q6IB0VH67tdKAwiScXxmb6m1+YtLw4Cg5+Fo92MZwDcCNTdnKR7wibdjTYHctTDI UHDO/NCi3wcaje+Cv/KRKljcNnNTjG7NKVwgv76A5lSQ5l4FCEkAGHzjDNNv6qtVeWfN O81oknFqynD3KJL6n2lKJ/6XZizlTyMHJ1WZoEgGVu8sm4AaEOIAFOcHg6qo0kOCs0Pm P2gCOeLzCuFlby2uu8Eu5CnH6rB0e8LVNuwfVN7qenS9LEHs7gw5HYB0Xy2dqh1koejP sgTA== X-Gm-Message-State: ALoCoQmvFQbzRftP3+3y3H7GKKdvQtvpWTbIrm2JHFEBdvAQjVS4qkIU5UvH8SpKk3k426TtFy1p X-Received: by 10.182.241.97 with SMTP id wh1mr5105865obc.36.1397679981528; Wed, 16 Apr 2014 13:26:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.145 with SMTP id c17ls732675qgd.60.gmail; Wed, 16 Apr 2014 13:26:21 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr3162863vdb.20.1397679981357; Wed, 16 Apr 2014 13:26:21 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id tq2si4053022vdc.93.2014.04.16.13.26.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Apr 2014 13:26:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so11831684veb.28 for ; Wed, 16 Apr 2014 13:26:21 -0700 (PDT) X-Received: by 10.58.137.169 with SMTP id qj9mr66571veb.46.1397679981275; Wed, 16 Apr 2014 13:26:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp340753vcb; Wed, 16 Apr 2014 13:26:20 -0700 (PDT) X-Received: by 10.224.38.136 with SMTP id b8mr5363405qae.98.1397679980859; Wed, 16 Apr 2014 13:26:20 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id x7si9624959qaj.2.2014.04.16.13.26.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Apr 2014 13:26:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaWO0-0006Hm-1d; Wed, 16 Apr 2014 20:24:48 +0000 Received: from mail-qc0-f172.google.com ([209.85.216.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaWNv-00054n-8n for linux-arm-kernel@lists.infradead.org; Wed, 16 Apr 2014 20:24:45 +0000 Received: by mail-qc0-f172.google.com with SMTP id i8so12354566qcq.17 for ; Wed, 16 Apr 2014 13:24:20 -0700 (PDT) X-Received: by 10.224.38.209 with SMTP id c17mr7800296qae.11.1397679860621; Wed, 16 Apr 2014 13:24:20 -0700 (PDT) Received: from [10.1.10.24] (c-76-24-48-141.hsd1.nh.comcast.net. [76.24.48.141]) by mx.google.com with ESMTPSA id w14sm26368556qaw.11.2014.04.16.13.24.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Apr 2014 13:24:20 -0700 (PDT) Message-ID: <534EE6F2.3050005@linaro.org> Date: Wed, 16 Apr 2014 16:24:18 -0400 From: David Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: David Miller , oleg@redhat.com Subject: Re: [RFC PATCH v4] ARM: uprobes xol write directly to userspace References: <20140416164310.GA15739@redhat.com> <20140416.133831.364304583096073299.davem@davemloft.net> <20140416191825.GA22246@redhat.com> <20140416.153734.675854782374654510.davem@davemloft.net> In-Reply-To: <20140416.153734.675854782374654510.davem@davemloft.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140416_132443_394032_2B657B04 X-CRM114-Status: GOOD ( 16.54 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.172 listed in list.dnswl.org] Cc: tixy@linaro.org, linaro-kernel@lists.linaro.org, ananth@in.ibm.com, victor.kamensky@linaro.org, peterz@infradead.org, taras.kondratiuk@linaro.org, rabin@rab.in, rmk@arm.linux.org.uk, torvalds@linux-foundation.org, Dave.Martin@arm.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dave.long@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On 04/16/14 15:37, David Miller wrote: > From: Oleg Nesterov > Date: Wed, 16 Apr 2014 21:18:25 +0200 > >> The last question... area->page = alloc_page(GFP_HIGHUSER), and I am >> not sure that arch/arm/mm/highmem.c:kmap_atomic() can't break the >> aliasing, __fix_to_virt() in this case will use the same (per-cpu) idx. >> >> Looks like, __kunmap_atomic()->__cpuc_flush_dcache_area() should take >> care, but could you please ack/nack my understanding? > > Good point, it might therefore make sense to use a low-mem page. > The following test code seems to have the same problems with stale user icache. It works if I put the dcache flush back in. Am I missing something? -dl diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 04709b6..10ad973 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -34,6 +34,7 @@ #include /* user_enable_single_step */ #include /* notifier mechanism */ #include "../../mm/internal.h" /* munlock_vma_page */ +#include #include #include @@ -1141,7 +1142,7 @@ static int xol_add_vma(struct mm_struct *mm, struct xol_area *area) if (!area->vaddr) { /* Try to map as high as possible, this is only a hint. */ area->vaddr = get_unmapped_area(NULL, TASK_SIZE - PAGE_SIZE, - PAGE_SIZE, 0, 0); + PAGE_SIZE, page_to_pfn(area->page), MAP_SHARED); if (area->vaddr & ~PAGE_MASK) { ret = area->vaddr; goto fail; @@ -1175,7 +1176,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr) if (!area->bitmap) goto free_area; - area->page = alloc_page(GFP_HIGHUSER); + area->page = alloc_page(GFP_USER); if (!area->page) goto free_bitmap; @@ -1299,11 +1300,8 @@ static unsigned long xol_get_insn_slot(struct uprobe *uprobe) /* Initialize the slot */ copy_to_page(area->page, xol_vaddr, &uprobe->arch.ixol, sizeof(uprobe->arch.ixol)); - /* - * We probably need flush_icache_user_range() but it needs vma. - * This should work on supported architectures too. - */ - flush_dcache_page(area->page); +/* Temporary hard-core icache flush for testing */ + __flush_icache_all(); return xol_vaddr; }