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: 3246161 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 40200C045B for ; Wed, 27 Nov 2013 03:00:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AAE82052A for ; Wed, 27 Nov 2013 03:00:31 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F0D1201B3 for ; Wed, 27 Nov 2013 03:00:30 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VlVMV-0004XM-9y; Wed, 27 Nov 2013 03:00:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VlVMS-0007ZV-Pz; Wed, 27 Nov 2013 03:00:20 +0000 Received: from mail-qa0-f44.google.com ([209.85.216.44]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VlVMQ-0007Ys-9T for linux-arm-kernel@lists.infradead.org; Wed, 27 Nov 2013 03:00:18 +0000 Received: by mail-qa0-f44.google.com with SMTP id i13so5236649qae.17 for ; Tue, 26 Nov 2013 18:59:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hV8m2gEU8RnLpD0BmKHSFoX02EvyT1AZXnsPpElufpU=; b=ccZgHcBSLiC/M3xAkt0UsJQyKvZ3dxzcFqwGUcKKCD4HZCmFZtnqoa2T3CxMV7qraD 22f6W733UPOLiXQDSqe5Fo50/cdR87pNirNbtsgnRb5MaD5I7YnrLRS1mEM5KRZqhIM6 NVRSb3dhYg/n5SORUuJXL+pJBqeL9P4mLWCQW1omO6sO17PaDgNOK3LA/9qzadmsmMkh q6Z9crJ1tx2Seh8rYW/XUxc7cQS6UXcT4/3JxzbChgOaYRyzj+KFLvBBckuO3Ki1EjZv 7RO36sTz1I9K47HZsTbM7LoASpoLgDYJxEfaus2kBsXGRJ5EIG8JUSPKMVLtEjAbwLbX Ixig== X-Gm-Message-State: ALoCoQniye0Q0ngZiK2naokH4e7t2NbtazyDzWTDjWGIH0JRmK3ENO3fbjhugbwEXLL2CTcn+mGF 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131126_220018_390058_8D67C8D4 X-CRM114-Status: GOOD ( 12.16 ) X-Spam-Score: -2.6 (--) Cc: "Jon Medhurst \(Tixy\)" , Peter Zijlstra , Srikar Dronamraju , Oleg Nesterov , Anil S Keshavamurthy , linux-kernel@vger.kernel.org, Rabin Vincent , Ingo Molnar , Paul Mackerras , Arnaldo Carvalho de Melo , Masami Hiramatsu , davem@davemloft.net, Ananth N Mavinakayanahalli X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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;