From patchwork Thu Jan 23 20:05:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 23640 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 206DE203C3 for ; Thu, 23 Jan 2014 20:06:06 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id oz11sf4145971veb.4 for ; Thu, 23 Jan 2014 12:06:05 -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=FeWzQuE/a+IWyZXRy8l6bKo/EHenmRzyn1eLiLnazyAYpxRuJt3kJ6HcJ+wntMwVLG u9h0u9LBzBVogaNwq2yjrdytPnkL4ZeU/gConE69e9Kv2SBCTDd+nysM4obieSdIHS8j RcWPTQv73NKjHICx3kHo4gGkbe1aHmhKUoEgRSAMXMCT8bfoNNv5+wEFxID3+Y6X+vqQ 8PArWwXmF8GUO/zgjDwzwOZ04QEWX//RfxVVGNMLxod4i508eOvNd1QWWMM8u6QPzkIO /ypdPYqCNwEManYQ0xJJ2P1BtPEetR6QZjdP0hhxU0ZNHKHCZ13dQnhkjWbJa2Inju6E +Oyg== X-Gm-Message-State: ALoCoQmk8tuXaaJJOt1DV+dVakge/NlSwW3Vq2htxMvTpzvSQmHL1N9cXCDbS8AkYi0d7bi1ekIC X-Received: by 10.236.26.209 with SMTP id c57mr3245785yha.45.1390507565243; Thu, 23 Jan 2014 12:06:05 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.84 with SMTP id s78ls419947qgd.56.gmail; Thu, 23 Jan 2014 12:06:05 -0800 (PST) X-Received: by 10.58.85.133 with SMTP id h5mr5491562vez.4.1390507565107; Thu, 23 Jan 2014 12:06:05 -0800 (PST) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id yv5si7213656veb.26.2014.01.23.12.06.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 12:06:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.172 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.172; Received: by mail-vc0-f172.google.com with SMTP id lf12so1344278vcb.17 for ; Thu, 23 Jan 2014 12:06:05 -0800 (PST) X-Received: by 10.221.17.134 with SMTP id qc6mr59339vcb.47.1390507565024; Thu, 23 Jan 2014 12:06:05 -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 u4csp51568vcz; Thu, 23 Jan 2014 12:06:04 -0800 (PST) X-Received: by 10.140.48.172 with SMTP id o41mr14088997qga.16.1390507564506; Thu, 23 Jan 2014 12:06:04 -0800 (PST) Received: from mail-qa0-f51.google.com (mail-qa0-f51.google.com [209.85.216.51]) by mx.google.com with ESMTPS id y1si8532665qal.120.2014.01.23.12.06.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 12:06:04 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.51 is neither permitted nor denied by best guess record for domain of dave.long@linaro.org) client-ip=209.85.216.51; Received: by mail-qa0-f51.google.com with SMTP id f11so2782912qae.38 for ; Thu, 23 Jan 2014 12:06:04 -0800 (PST) X-Received: by 10.140.36.107 with SMTP id o98mr13824127qgo.25.1390507564337; Thu, 23 Jan 2014 12:06:04 -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 js9sm13677540qeb.9.2014.01.23.12.06.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 12:06: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 v5 01/16] uprobes: allow ignoring of probe hits Date: Thu, 23 Jan 2014 15:05:44 -0500 Message-Id: <1390507559-4697-2-git-send-email-dave.long@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1390507559-4697-1-git-send-email-dave.long@linaro.org> References: <1390507559-4697-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.172 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;