From patchwork Wed Nov 27 02:53:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 21786 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E5C16202DA for ; Wed, 27 Nov 2013 02:53:39 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id jw12sf15675515veb.11 for ; Tue, 26 Nov 2013 18:53:39 -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=hV8m2gEU8RnLpD0BmKHSFoX02EvyT1AZXnsPpElufpU=; b=BZ7ApFWL04PRZcvwkFwcO/JyVY/lqKbzmLllA6VO85MNgbahWpt08j6MS/mj/uLlQH UAjeD2tR/ELSM7S964kP6TWSI0gGI1/kxl5q+f1eaad3nkM5YMLW3lx4OChP95WB+ad7 au1fZfsV1SlwVI+dWxnm5aWIbyHrFo/RPPGKz20TpFpfRxCuv1LVmvXm6IjMERwE2zQE s4ow7XzdukVKCrB/NJotc58xZj3Tfyq0oCz7rFdaG779EtVbmuTp3jlLOTTMkPEFMtbr mLIkDGV6Mr7QB6+BlcxMl2qoS2dUHHzmE13neb3MM6GLNqqktz8gTMG9Vb/Z9JuO+Uhj 6NKg== X-Gm-Message-State: ALoCoQlRZoR81m/ijF2/DLJoJ2G1zABQNPXYLWipv/BdxVjxIPj/mibTLY6xhDnXO5ZIxuuv0E0V X-Received: by 10.58.50.161 with SMTP id d1mr11221230veo.24.1385520819767; Tue, 26 Nov 2013 18:53:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.36.136 with SMTP id q8ls1977618qej.36.gmail; Tue, 26 Nov 2013 18:53:39 -0800 (PST) X-Received: by 10.58.67.9 with SMTP id j9mr32571729vet.3.1385520819669; Tue, 26 Nov 2013 18:53:39 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id tg7si1636042vdc.48.2013.11.26.18.53.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 18:53:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so4439183vcb.37 for ; Tue, 26 Nov 2013 18:53:39 -0800 (PST) X-Received: by 10.53.2.36 with SMTP id bl4mr272947vdd.32.1385520819590; Tue, 26 Nov 2013 18:53:39 -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 u4csp254121vcz; Tue, 26 Nov 2013 18:53:39 -0800 (PST) X-Received: by 10.224.94.8 with SMTP id x8mr62706786qam.1.1385520819114; Tue, 26 Nov 2013 18:53:39 -0800 (PST) Received: from mail-qa0-f53.google.com (mail-qa0-f53.google.com [209.85.216.53]) by mx.google.com with ESMTPS id s9si13140041qak.97.2013.11.26.18.53.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 18:53:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.53 is neither permitted nor denied by best guess record for domain of dave.long@linaro.org) client-ip=209.85.216.53; Received: by mail-qa0-f53.google.com with SMTP id j5so8889280qaq.12 for ; Tue, 26 Nov 2013 18:53:39 -0800 (PST) X-Received: by 10.224.29.140 with SMTP id q12mr1704847qac.93.1385520818894; Tue, 26 Nov 2013 18:53:38 -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 fc16sm56880235qeb.3.2013.11.26.18.53.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 18:53:38 -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 v3 01/15] uprobes: allow ignoring of probe hits Date: Tue, 26 Nov 2013 21:53:20 -0500 Message-Id: <1385520814-10663-2-git-send-email-dave.long@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1385520814-10663-1-git-send-email-dave.long@linaro.org> References: <1385520814-10663-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.178 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. Upleveled for v3.12-rc5. Signed-off-by: David A. Long --- 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 319eae7..197a36e 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -134,6 +134,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 24b7d6c..4eec7ce 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1778,6 +1778,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. @@ -1828,7 +1833,11 @@ static void handle_swbp(struct pt_regs *regs) if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags))) goto out; + if (arch_uprobe_ignore(&uprobe->arch, regs)) + goto out; + handler_chain(uprobe, regs); + if (can_skip_sstep(uprobe, regs)) goto out;