From patchwork Sun Oct 14 19:23:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 1591611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id D2098E00AD for ; Sun, 14 Oct 2012 19:26:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TNTnS-000623-4K; Sun, 14 Oct 2012 19:24:22 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TNTmr-0005wU-5k for linux-arm-kernel@lists.infradead.org; Sun, 14 Oct 2012 19:23:46 +0000 Received: by mail-lb0-f177.google.com with SMTP id gi11so2942888lbb.36 for ; Sun, 14 Oct 2012 12:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=6P2MVpgobNgvM02UXaUyRlkSPBKsRy4vaVY1A+/saWM=; b=wm3XFhIOPGm8nEPyi5xeusXIMkW3vX1/pTMXhvqdZpx/UCHp+yQXvTyS6Y2iX8cUuM 0TlKiTYMSF/FP7a1sm3gw2F0Qw9zi3e5clSvpVUtWC+ADDZyXEN3ztWpxIhzai1dw2/o kpkv/wJhPUrfbgH/z5nwvzS/5BC7C8ti67VEB1Tp4Y9H5aQkkc1IsCyiQAfW9pxJngEO ivCF192jRv9m4Q238h7Ujh2SLGYHlUUWZRHO9z9tJjI16XmQxk3V2BFhnHUeJP1nwgv6 uiafrMLuhM5oCuzWlBFMBSGiRehsRtd3Lo3TiDhbV926JHuf36cTqO/IuQKtT+OiPWU9 Jw/A== Received: by 10.152.135.41 with SMTP id pp9mr8400017lab.7.1350242623624; Sun, 14 Oct 2012 12:23:43 -0700 (PDT) Received: from localhost.localdomain (c83-254-195-218.bredband.comhem.se. [83.254.195.218]) by mx.google.com with ESMTPS id ef4sm556036lbb.13.2012.10.14.12.23.41 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 14 Oct 2012 12:23:42 -0700 (PDT) From: Rabin Vincent To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/9] uprobes: allow arch access to xol slot Date: Sun, 14 Oct 2012 21:23:08 +0200 Message-Id: <1350242593-17761-4-git-send-email-rabin@rab.in> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350242593-17761-1-git-send-email-rabin@rab.in> References: <1350242593-17761-1-git-send-email-rabin@rab.in> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rabin.vincent[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Peter Zijlstra , Rabin Vincent , Srikar Dronamraju , oleg@redhat.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Allow arches to customize how the instruction is filled into the xol slot. ARM will use this to insert an undefined instruction after the real instruction in order to simulate a single step of the instruction without hardware support. Signed-off-by: Rabin Vincent --- include/linux/uprobes.h | 1 + kernel/events/uprobes.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index da21b66..b4380ad 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -129,6 +129,7 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk); extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); +extern void __weak arch_uprobe_xol_copy(struct arch_uprobe *auprobe, void *vaddr); #else /* !CONFIG_UPROBES */ struct uprobes_state { }; diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index a0e1a38..f7ff3a4 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1211,6 +1211,11 @@ static unsigned long xol_take_insn_slot(struct xol_area *area) return slot_addr; } +void __weak arch_uprobe_xol_copy(struct arch_uprobe *auprobe, void *vaddr) +{ + memcpy(vaddr, auprobe->insn, MAX_UINSN_BYTES); +} + /* * xol_get_insn_slot - If was not allocated a slot, then * allocate a slot. @@ -1240,7 +1245,7 @@ static unsigned long xol_get_insn_slot(struct uprobe *uprobe, unsigned long slot current->utask->vaddr = slot_addr; offset = current->utask->xol_vaddr & ~PAGE_MASK; vaddr = kmap_atomic(area->page); - memcpy(vaddr + offset, uprobe->arch.insn, MAX_UINSN_BYTES); + arch_uprobe_xol_copy(&uprobe->arch, vaddr + offset); kunmap_atomic(vaddr); return current->utask->xol_vaddr;