Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2204753imm; Mon, 28 May 2018 03:55:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrqvS8DiDLKw/SXN55kI0TOLgEPwXPVQlyc7Fib3LGNdqfqrLvjePX/+/VpJ44tQ+6r3Vsf X-Received: by 2002:a63:6502:: with SMTP id z2-v6mr10383716pgb.159.1527504905373; Mon, 28 May 2018 03:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527504905; cv=none; d=google.com; s=arc-20160816; b=brrjAltJvJutdP8c5gJ5xFcge77qIkmmw4F+wuK1ePTBavtsE+G4J+h4dhA8DrEvch EhNRPcgVeqp+NyhvFcKpM8A/MDgwrQF8BMpw2oMxnFkyXo1h0a7FRiIbey/nyQ0LBWHV 41VxWRnZg5utNRIkwma0mG5rmCqtIQrJu7RSEzUdS5VWlDuxKxSeV/wezxdeZPHBYMHy HXEZ/Wm2jNMKs4ELUvSFiipdGuTqjh/KVyIG1dswCzqJYJyy6BH/JHbdiN4c01IYzjbh cVKxrtgdIclq0ildMhe4qE5IXeB0PXp4u6aXJViQs3J16YJY5soRksxVZoar+ownB0fP Prpg== 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=/5iUshP6B8Kb0KC7r4DQCUOWCMZCeWESmJKQ8QI0sEc=; b=gZ8aSk3JRVsHIv/M4S4lvNKOicgPJ6vE4EZLMZaGiGSn4RzFtJvACcTTfVbqn/0kxn DsF1XuUifFRTsXlEziJxNZoJ//RgiZWEai5SmIEE37/ZP0CZ2bjaFhUKdOcnQFcpQgS9 WgpTPiQUcoA8u52wLsxIP4RG1yk8FcdfWkMqY1kBBU5Wc9QCyhrCOHsu5tPjBA4unMzb XT/60VAy/83ap6KuGP2kWG7anZb5/6F2bjC3s2CnZ9opxhX5dT7YJSdwhafjRwfPciwK 5ZAX6K+55gY425pHjn0V+Fvt2tzKQ73KWJfCkiP0Af51XSCdTamut4Os2CYPWUc8uoCw 0RNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YtbV1XV+; 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 z31-v6si29926287plb.200.2018.05.28.03.54.50; Mon, 28 May 2018 03:55:05 -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=YtbV1XV+; 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 S1164299AbeE1Kyh (ORCPT + 99 others); Mon, 28 May 2018 06:54:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:43350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164279AbeE1Ky3 (ORCPT ); Mon, 28 May 2018 06:54:29 -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 0BB4420845; Mon, 28 May 2018 10:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504868; bh=z88tkpxx2rewf3fnAozVyhsAjkAAxPuKk8Go+qQmRiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YtbV1XV+G4ImxUws+Ss7nqMa+tHvMG/sGn4fJ3rAFGRO6E4w7l9Rq+Fdk80bX7/88 MvHhQQQReUuaPso91lKedgdWvW1sp3xKiAsec8UDKcEdk2XIyoAMI6rkA2WNxxUqD9 r7Az7tvCBfea9R/5isvc1/FX8egahSotxl3IBDpw= 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 4.14 293/496] selftests: ftrace: Add a testcase for probepoint Date: Mon, 28 May 2018 12:01:18 +0200 Message-Id: <20180528100332.168568461@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@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 4.14-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