From patchwork Wed Aug 12 16:57:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 52349 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id D683A22DD8 for ; Wed, 12 Aug 2015 16:57:54 +0000 (UTC) Received: by labth1 with SMTP id th1sf8064472lab.2 for ; Wed, 12 Aug 2015 09:57:53 -0700 (PDT) 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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=VGvUaCJiM3AR3nvHdxnUZBjcBkFS01l+brK7i6SWqWU=; b=OPFD+Rb8AhTTAJQBhthF1ZQX9fWO2JyQ5eHmXmgKbCPuDGo+eq8bJ9BtXvNzRIQM7x qgw2+c8/wAdtV+f74gEx9oiK8ee6d61/ttSoR/JX/OvWQ7uw3AU826pPWKCRSYGQLHK4 HMyfIh+m/MeGHjlVP0zAg7f/K3qDw6llC3h4vmXJWV1XLSZq8LDX7P3OHZ6qGHTwxhav ws5WJhlKf3XwyeJJB9/uXzys85VBjYr3Ui5duOX8ZiKMe9cOf5Jv8h/R2NCN5LHajT+7 DHlq0mXo3FYeUBdXnT3mikWKkeYNJPeaiQgayKR/HLUDG7IBz6UodSplpPA7GiDTx2jp eObA== X-Gm-Message-State: ALoCoQlBgAfThyFpYBUq2lfFnCwb58HfI9RQimLQxQIZ3cXyxqfUDwhYwgnq92zVYxMtaLSKWcDj X-Received: by 10.112.138.2 with SMTP id qm2mr9971806lbb.19.1439398673760; Wed, 12 Aug 2015 09:57:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.227 with SMTP id n3ls75843lan.0.gmail; Wed, 12 Aug 2015 09:57:53 -0700 (PDT) X-Received: by 10.112.169.97 with SMTP id ad1mr20401413lbc.90.1439398673515; Wed, 12 Aug 2015 09:57:53 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id u9si5262747lbw.89.2015.08.12.09.57.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Aug 2015 09:57:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by lalv9 with SMTP id v9so12574501lal.0 for ; Wed, 12 Aug 2015 09:57:53 -0700 (PDT) X-Received: by 10.152.164.130 with SMTP id yq2mr24974715lab.76.1439398673330; Wed, 12 Aug 2015 09:57:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp444358lba; Wed, 12 Aug 2015 09:57:52 -0700 (PDT) X-Received: by 10.66.141.5 with SMTP id rk5mr70260553pab.16.1439398671374; Wed, 12 Aug 2015 09:57:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ub9si3781482pac.40.2015.08.12.09.57.50; Wed, 12 Aug 2015 09:57:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932503AbbHLQ5s (ORCPT + 28 others); Wed, 12 Aug 2015 12:57:48 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:37537 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932195AbbHLQ5r (ORCPT ); Wed, 12 Aug 2015 12:57:47 -0400 Received: by wibhh20 with SMTP id hh20so38462898wib.0 for ; Wed, 12 Aug 2015 09:57:46 -0700 (PDT) X-Received: by 10.194.172.130 with SMTP id bc2mr76355213wjc.85.1439398666479; Wed, 12 Aug 2015 09:57:46 -0700 (PDT) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by smtp.gmail.com with ESMTPSA id g13sm8792098wjs.21.2015.08.12.09.57.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Aug 2015 09:57:45 -0700 (PDT) From: Steve Capper To: linux-kernel@vger.kernel.org Cc: masami.hiramatsu.pt@hitachi.com, will.deacon@arm.com, sandeepa.s.prabhu@gmail.com, dave.long@linaro.org, catalin.marinas@arm.com, linux@arm.linux.org.uk, wcohen@redhat.com, tixy@linaro.org, ananth@in.ibm.com, anil.s.keshavamurthy@intel.com, davem@davemloft.net, broonie@kernel.org, Steve Capper Subject: [PATCH] kprobes: Update examples to target _do_fork Date: Wed, 12 Aug 2015 17:57:35 +0100 Message-Id: <1439398655-9357-1-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In commit 3033f14ab78c ("clone: support passing tls argument via C rather than pt_regs magic"), the kernel calls _do_fork in places where it previously called do_fork. Unfortunately, the kprobe examples target do_fork; thus no events appear to fire when one runs the example modules. This commit updates the kprobe example code s.t. _do_fork is targeted instead, and the examples work as expected. Signed-off-by: Steve Capper --- samples/kprobes/jprobe_example.c | 8 ++++---- samples/kprobes/kprobe_example.c | 2 +- samples/kprobes/kretprobe_example.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/kprobes/jprobe_example.c b/samples/kprobes/jprobe_example.c index 9119ac6..11dd54b 100644 --- a/samples/kprobes/jprobe_example.c +++ b/samples/kprobes/jprobe_example.c @@ -23,9 +23,9 @@ */ /* Proxy routine having the same arguments as actual do_fork() routine */ -static long jdo_fork(unsigned long clone_flags, unsigned long stack_start, +static long j_do_fork(unsigned long clone_flags, unsigned long stack_start, unsigned long stack_size, int __user *parent_tidptr, - int __user *child_tidptr) + int __user *child_tidptr, unsigned long tls) { pr_info("jprobe: clone_flags = 0x%lx, stack_start = 0x%lx " "stack_size = 0x%lx\n", clone_flags, stack_start, stack_size); @@ -36,9 +36,9 @@ static long jdo_fork(unsigned long clone_flags, unsigned long stack_start, } static struct jprobe my_jprobe = { - .entry = jdo_fork, + .entry = j_do_fork, .kp = { - .symbol_name = "do_fork", + .symbol_name = "_do_fork", }, }; diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c index 51d459c..597e101 100644 --- a/samples/kprobes/kprobe_example.c +++ b/samples/kprobes/kprobe_example.c @@ -16,7 +16,7 @@ /* For each probe you need to allocate a kprobe structure */ static struct kprobe kp = { - .symbol_name = "do_fork", + .symbol_name = "_do_fork", }; /* kprobe pre_handler: called just before the probed instruction is executed */ diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c index 1041b67..a270535 100644 --- a/samples/kprobes/kretprobe_example.c +++ b/samples/kprobes/kretprobe_example.c @@ -25,7 +25,7 @@ #include #include -static char func_name[NAME_MAX] = "do_fork"; +static char func_name[NAME_MAX] = "_do_fork"; module_param_string(func, func_name, NAME_MAX, S_IRUGO); MODULE_PARM_DESC(func, "Function to kretprobe; this module will report the" " function's execution time");