From patchwork Fri Mar 7 20:10:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 25899 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D6A94203C3 for ; Fri, 7 Mar 2014 20:11:07 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wo20sf17175088obc.10 for ; Fri, 07 Mar 2014 12:11:07 -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=kmyeiiwwQ52cBwPqtux9xdzFVVDQEftTxvD3yP8J/5Y6KnPLbpXmwpJgHhDXqAmgSQ 7rSRcGsJBeOgKwCax/XOaHByikVRAZGQBze+2NNCluvSTXII8Q49atAJB8mhP4Hkpf1z K3C1T+0gGYgEbzdPNc7ZdVhywqX0tJqzkiKw2tsohtNmkTzVYWPW42tRVrZgU5BHKKvx lzfe6L5eLsMRXrYP73OFsiWvIWnx3WSMc4jVgEXIVt2T5gVFta+7c/FHIfwcJTg64GAx FDmtbm/DAcQuw4TTQGag9nmz+x149GE8GnDMn3PibjsojeLqFZKi3n6yKO1b4NZq57GP ekig== X-Gm-Message-State: ALoCoQniZISbkN1tosi39FMfou1PihT4EGta6fbHiuKiwG93f7rFO1Ubpdpv/f8wT8egyAAL3sw0 X-Received: by 10.182.126.137 with SMTP id my9mr7649691obb.13.1394223067351; Fri, 07 Mar 2014 12:11:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.75 with SMTP id i69ls1261150qgd.66.gmail; Fri, 07 Mar 2014 12:11:07 -0800 (PST) X-Received: by 10.58.106.37 with SMTP id gr5mr50913veb.57.1394223067196; Fri, 07 Mar 2014 12:11:07 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id p9si3123826vdv.70.2014.03.07.12.11.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Mar 2014 12:11:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 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.176; Received: by mail-ve0-f176.google.com with SMTP id cz12so4640408veb.21 for ; Fri, 07 Mar 2014 12:11:07 -0800 (PST) X-Received: by 10.52.26.161 with SMTP id m1mr3574143vdg.24.1394223067106; Fri, 07 Mar 2014 12:11:07 -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.78.9 with SMTP id i9csp139722vck; Fri, 7 Mar 2014 12:11:06 -0800 (PST) X-Received: by 10.67.5.39 with SMTP id cj7mr23847138pad.7.1394223065401; Fri, 07 Mar 2014 12:11:05 -0800 (PST) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx.google.com with ESMTPS id tu7si9365119pac.222.2014.03.07.12.11.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Mar 2014 12:11:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.53 is neither permitted nor denied by best guess record for domain of dave.long@linaro.org) client-ip=209.85.220.53; Received: by mail-pa0-f53.google.com with SMTP id ld10so4601723pab.40 for ; Fri, 07 Mar 2014 12:11:05 -0800 (PST) X-Received: by 10.68.136.133 with SMTP id qa5mr24232873pbb.63.1394223065029; Fri, 07 Mar 2014 12:11:05 -0800 (PST) Received: from localhost.localdomain (n182z4l226.static.ctm.net. [182.93.4.226]) by mx.google.com with ESMTPSA id tu3sm12419427pab.1.2014.03.07.12.11.00 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Mar 2014 12:11:03 -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 v7 03/15] uprobes: allow ignoring of probe hits Date: Fri, 7 Mar 2014 15:10:28 -0500 Message-Id: <1394223040-17129-4-git-send-email-dave.long@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1394223040-17129-1-git-send-email-dave.long@linaro.org> References: <1394223040-17129-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.128.176 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;