From patchwork Mon Feb 10 07:38:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 24385 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9A4F7202B2 for ; Mon, 10 Feb 2014 07:39:14 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id h16sf27642290oag.8 for ; Sun, 09 Feb 2014 23:39:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=/PWWmXRHIF/9jfWKspR+aIxM0VL1n40+TJ1/noJmnUQ=; b=b5ARhOx5R4bfREmxjHzdvefkdJYJbQ2+WhB198tdhTm2TRaTgGuLHt3plG/PH5i+cC fIV5tum0e8MT4kO5Cnl1g10hbRiToY/DezUAgoy6qgkzwlNq3rX6CjAgTTyDZjIo78WD hWPXAV/PUqClR9wwRzIxJUV1cvtM+8Urx06xEfAIGnrTdJ/lKfsBb4+kWFx9yBVA7Ey0 ZQ3tLfvclRJCkRMdZlWDYDnsmOWr39FHGKNmiS5w75AIRQGXkz2OaMDOOopIuH9Gr3p4 2aKnj0MK1qBZ0RezQyS1IonXS8sGf8dv9n+mZGJNlMq+T5tdZ0kp5QJ7ODXYWimQNAPb +KCA== X-Gm-Message-State: ALoCoQlnuzerxJm/R+NRjYRLy5A2aKvUfOTroJnial1sPiylY/6lyPIkMWpaCjlfzuJSOEKBvwE1 X-Received: by 10.42.112.195 with SMTP id z3mr9303574icp.7.1392017953649; Sun, 09 Feb 2014 23:39:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.239 with SMTP id 102ls1899969qgx.23.gmail; Sun, 09 Feb 2014 23:39:13 -0800 (PST) X-Received: by 10.220.131.210 with SMTP id y18mr23030874vcs.12.1392017953578; Sun, 09 Feb 2014 23:39:13 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id a5si4554515vez.82.2014.02.09.23.39.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Feb 2014 23:39:13 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ks9so4422762vcb.39 for ; Sun, 09 Feb 2014 23:39:13 -0800 (PST) X-Received: by 10.52.243.102 with SMTP id wx6mr19037744vdc.12.1392017953501; Sun, 09 Feb 2014 23:39:13 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp148177vcz; Sun, 9 Feb 2014 23:39:13 -0800 (PST) X-Received: by 10.224.51.74 with SMTP id c10mr45131739qag.33.1392017952965; Sun, 09 Feb 2014 23:39:12 -0800 (PST) Received: from mail-qa0-f41.google.com (mail-qa0-f41.google.com [209.85.216.41]) by mx.google.com with ESMTPS id v8si9494110qab.81.2014.02.09.23.39.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Feb 2014 23:39:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.41 is neither permitted nor denied by best guess record for domain of dave.long@linaro.org) client-ip=209.85.216.41; Received: by mail-qa0-f41.google.com with SMTP id w8so9138842qac.0 for ; Sun, 09 Feb 2014 23:39:12 -0800 (PST) X-Received: by 10.140.50.46 with SMTP id r43mr1937576qga.22.1392017952719; Sun, 09 Feb 2014 23:39:12 -0800 (PST) Received: from localhost.localdomain (pool-72-71-243-183.cncdnh.fast00.myfairpoint.net. [72.71.243.183]) by mx.google.com with ESMTPSA id k107sm22671621qgk.5.2014.02.09.23.39.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Feb 2014 23:39:09 -0800 (PST) From: David Long To: linux-arm-kernel@lists.infradead.org, Russell King Cc: Rabin Vincent , "Jon Medhurst (Tixy)" , Oleg Nesterov , Srikar Dronamraju , Ingo Molnar , Masami Hiramatsu , Ananth N Mavinakayanahalli , Anil S Keshavamurthy , , Peter Zijlstra , Paul Mackerras , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org Subject: [PATCH v6 01/14] uprobes: allow ignoring of probe hits Date: Mon, 10 Feb 2014 02:38:52 -0500 Message-Id: <1392017945-4507-2-git-send-email-dave.long@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1392017945-4507-1-git-send-email-dave.long@linaro.org> References: <1392017945-4507-1-git-send-email-dave.long@linaro.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.220.180 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: "David A. Long" Allow arches to decided to ignore a probe hit. ARM will use this to only call handlers if the conditions to execute a conditionally executed instruction are satisfied. Signed-off-by: David A. Long Acked-by: Oleg Nesterov --- include/linux/uprobes.h | 1 + kernel/events/uprobes.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index e32251e..edff2b9 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -126,6 +126,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 unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); +extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); #else /* !CONFIG_UPROBES */ struct uprobes_state { }; diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 307d87c..04709b6 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1804,6 +1804,11 @@ static bool handle_trampoline(struct pt_regs *regs) return true; } +bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs) +{ + return false; +} + /* * Run handler and ask thread to singlestep. * Ensure all non-fatal signals cannot interrupt thread while it singlesteps. @@ -1858,7 +1863,11 @@ static void handle_swbp(struct pt_regs *regs) if (!get_utask()) goto out; + if (arch_uprobe_ignore(&uprobe->arch, regs)) + goto out; + handler_chain(uprobe, regs); + if (can_skip_sstep(uprobe, regs)) goto out;