Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2511319imm; Mon, 28 May 2018 09:27:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq7K+oVkiAH5SCm5T+RdYGyKmBWi75nodosz4hT8tInrCHwz0sFhk+M5340k853XHM+9QY4 X-Received: by 2002:a17:902:9a06:: with SMTP id v6-v6mr14202286plp.21.1527524861256; Mon, 28 May 2018 09:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527524861; cv=none; d=google.com; s=arc-20160816; b=gXdoa/Zd8hRi1+KdA1uPx+mo4Ij2qBXkgJxeziXCotsi0NRxaTdtjZXidxuIUpnanR 3/la4Zx1Fx1K/voCIokxS5aHH5R2QzOhWhZiylXjjbMFJFbO6GxuPDO5blGLCpBCqYEF qzAnnc+Pv/culIzXDG55DFuUxv6AWxDFXlb8Wlf35U+KeOfnxVUad60aFf3X817NT5It xPjseZZSeFCeYgIGwcCPSR4WjCAYSdyGqEor/UJo44Qg9RImEQ7yHcPPVl07qZIiQIyk +kAPcoHdIG3dQMn/gIJ+ho6Yp9Pc05yvDFHHzw/JEehHBSe+hKxN/kpDVmGmFWOfkMGV 9jHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=U0grq+O+y/tGXwTN82eDUq+0vuoQ03Qh48O7h8rJPrQ=; b=Oz0PLeiYT1qz0nd1rDxIXVYBb8GkxsopNnABMwikFHerxn9uUbHFcIYOBhgRHKO6XZ rw6P0QEORo1p+cOWrYtwD+T+J8R4Z+EWvZ2ABjoAO64mqiCa/clmBVQU3Vki2D6qTe+F wOwjw+pXV4MCSVLatpsYLMsvOC9M9Q5V7WqfK56l5DXOgT0YAoaWWyMbrv5/eHtBAMFm KvA0Jmpln0mgtXMD+Mj1r1Dq4VzPt725m1XGZEh4CJsbv1iDC6RYUp8QJeBwj9cR5E/4 sUiOOeJJVNcs37s0T+HAGr59TtQUM4w8Y8aKgQiYN9c/3+LU2zC/UR9xq18vPIkcfUmD G+tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t4bLwtBC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si23902814pgt.625.2018.05.28.09.27.26; Mon, 28 May 2018 09:27:41 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t4bLwtBC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425334AbeE1Q0x (ORCPT + 99 others); Mon, 28 May 2018 12:26:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:58618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936487AbeE1KK1 (ORCPT ); Mon, 28 May 2018 06:10:27 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8D24208AD; Mon, 28 May 2018 10:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502227; bh=9UYQkvkY1TlK0knxeem8Ns+nisjsnkxtrtBFxZIcH1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4bLwtBCRYkXqfVHJUIuSsvoHpbFbnt+RTNt1WU6X8QMTq0oNbVO5B996EmFlPjlX rDmN4XthkswpM8NwQPnhTUJ+PGyz48PYS02IVxJUNoyVlk4nNQannyqN5t1DKsyStg O3Kek3ogqDAYQ3jfiZsM1pOmecqL1KO41RzVq5fs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 3.18 101/185] selftests: ftrace: Add a testcase for probepoint Date: Mon, 28 May 2018 12:02:22 +0200 Message-Id: <20180528100059.743407127@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masami Hiramatsu [ Upstream commit dfa453bc90eca0febff33c8d292a656e53702158 ] Add a testcase for probe point definition. This tests symbol, address and symbol+offset syntax. The offset must be positive and smaller than UINT_MAX. Link: http://lkml.kernel.org/r/152129043097.31874.14273580606301767394.stgit@devbox Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc | 43 +++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc @@ -0,0 +1,43 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe events - probe points + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +TARGET_FUNC=create_trace_kprobe + +dec_addr() { # hexaddr + printf "%d" "0x"`echo $1 | tail -c 8` +} + +set_offs() { # prev target next + A1=`dec_addr $1` + A2=`dec_addr $2` + A3=`dec_addr $3` + TARGET="0x$2" # an address + PREV=`expr $A1 - $A2` # offset to previous symbol + NEXT=+`expr $A3 - $A2` # offset to next symbol + OVERFLOW=+`printf "0x%x" ${PREV}` # overflow offset to previous symbol +} + +# We have to decode symbol addresses to get correct offsets. +# If the offset is not an instruction boundary, it cause -EILSEQ. +set_offs `grep -A1 -B1 ${TARGET_FUNC} /proc/kallsyms | cut -f 1 -d " " | xargs` + +UINT_TEST=no +# printf "%x" -1 returns (unsigned long)-1. +if [ `printf "%x" -1 | wc -c` != 9 ]; then + UINT_TEST=yes +fi + +echo 0 > events/enable +echo > kprobe_events +echo "p:testprobe ${TARGET_FUNC}" > kprobe_events +echo "p:testprobe ${TARGET}" > kprobe_events +echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events +! echo "p:testprobe ${TARGET_FUNC}${PREV}" > kprobe_events +if [ "${UINT_TEST}" = yes ]; then +! echo "p:testprobe ${TARGET_FUNC}${OVERFLOW}" > kprobe_events +fi +echo > kprobe_events +clear_trace