From patchwork Mon Dec 16 04:08:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 22490 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C487B23FC7 for ; Mon, 16 Dec 2013 04:08:59 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id v10sf13901316pde.0 for ; Sun, 15 Dec 2013 20:08:58 -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=OvNOu2lGUEGYF3hoOV0A4BOtz8HNeqpGtkEmWpf18ys=; b=SZZLypBtPZSWAmyQTS46RtMjdD4fl4heWDRBoHllizTJzo3s6enXMPEQW9CQlQsaUm FaWdIPg8/R5s+Fyth5Xlho/3nGeN7sJBciENWny0urIHl+RvDNuQPAcbHRP0wi1UPR/b r++oejuT5KO5JdPnTTMWP16GrYN9J0q0JLUrUrrc6aAL3GqOjRqk5lOYBjh7/Qqrvwdp kERPXzViaU8ogLSV2yqTvfn1Ryd0kXZ8W2x8OPC/om42WqBXKX34qlkKyH77eQz1tgSY 31a8zQ3MlbUGr5p+4mms+yxh72ZSaaLdOyE3QvCN1yQw1QIo+xdB2lq/gY7Yh+EzhWqs IBPg== X-Gm-Message-State: ALoCoQnmVSeiWFno5Cj9oAFX0VcUd3v+2KhG7O3WtYcIAJYHYOvtTEwJjOdNNUD3we9yPCw2+P+Z X-Received: by 10.66.141.231 with SMTP id rr7mr7583pab.47.1387166938204; Sun, 15 Dec 2013 20:08:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.39.102 with SMTP id o6ls1906920qek.28.gmail; Sun, 15 Dec 2013 20:08:58 -0800 (PST) X-Received: by 10.58.254.200 with SMTP id ak8mr7517850ved.12.1387166938020; Sun, 15 Dec 2013 20:08:58 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id cy15si3621926veb.30.2013.12.15.20.08.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Dec 2013 20:08:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id w5so2853492vbf.1 for ; Sun, 15 Dec 2013 20:08:57 -0800 (PST) X-Received: by 10.52.168.4 with SMTP id zs4mr7411vdb.59.1387166937944; Sun, 15 Dec 2013 20:08:57 -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 u4csp69914vcz; Sun, 15 Dec 2013 20:08:57 -0800 (PST) X-Received: by 10.229.249.66 with SMTP id mj2mr28728341qcb.4.1387166937343; Sun, 15 Dec 2013 20:08:57 -0800 (PST) Received: from mail-qc0-f174.google.com (mail-qc0-f174.google.com [209.85.216.174]) by mx.google.com with ESMTPS id r6si10553618qaj.175.2013.12.15.20.08.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Dec 2013 20:08:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.174 is neither permitted nor denied by best guess record for domain of dave.long@linaro.org) client-ip=209.85.216.174; Received: by mail-qc0-f174.google.com with SMTP id n7so3341571qcx.33 for ; Sun, 15 Dec 2013 20:08:56 -0800 (PST) X-Received: by 10.224.167.144 with SMTP id q16mr6627552qay.71.1387166936712; Sun, 15 Dec 2013 20:08:56 -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 hb2sm36013890qeb.6.2013.12.15.20.08.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Dec 2013 20:08:55 -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 v4 01/16] uprobes: allow ignoring of probe hits Date: Sun, 15 Dec 2013 23:08:35 -0500 Message-Id: <1387166930-13182-2-git-send-email-dave.long@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1387166930-13182-1-git-send-email-dave.long@linaro.org> References: <1387166930-13182-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.212.42 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 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;