Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp953161img; Fri, 22 Mar 2019 12:10:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwW5Fn0h6KVNhJRd8W9HhO3DEg6NdddIi+Pd7VPeynRVNoR/qRhWf6tSHTG2GfhTxZRU3it X-Received: by 2002:a17:902:1125:: with SMTP id d34mr11388598pla.75.1553281834015; Fri, 22 Mar 2019 12:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553281834; cv=none; d=google.com; s=arc-20160816; b=T6Jj9BGoH6mB7QD1ekmA0wORUwDZsq1ZPbb82f7ivSJHvoMP6JeSlqvDMLxDG6hT0l C9wmvqQ9AHRw6E5s2QiFYflC7YXY2zdd46OX7vwqWXn3BR6MwzJ7QhWw1STr6UDOafux tADhSNk5wDi7XdVmny74WuTs1jHIXiPHPuJrGk4A91wIs2TSEkLoVSHDFGDmtNzENt45 AV3ypQOZoeCbpgBVYEOJNYYrEV7eWP/Q21fgJH7GDuYp8dH5+5C/P/t1CMliD9V9b5nm YKowsSrQhLckSUY7ubyyCerojaIdIsbs33GyOtQYTY/ZObcAL7ywyJ6GyXf6iyT3jE2p 86Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=iJEzMtBLTcGb9IBSzUXLrkBYZ42DnRNyS7Fjr2YRw6s=; b=ZCh9WNHxFFt9hkbOjjviDNRUZxug2M5775egfQQnn9UnLcWTcPsiTClzL4GusLDP6d N60p9JgOk7iX1ZO8pAa3IUtOsOMTK2j8aamSOoDWNTT3XYibvoembEWOQLsHj1rrssyS iG0BooF/psjVmavE6W4qJfwC+rfMsk5csGNJ7pt3fm+y63Afqa6nMw3cYd41lteSeHBz Q5J/YyISXfErzWHqzUj/rJsDUJQf43PA+ppVgXDfM5MHrS6aiAqsO8LUwLZjWUIwThmy 4EB+6Wcram5//KtC4HF+aBWUIphwTGWr7qwSM9u3fhXEPItwDE7ItJokF0GxgWvkGCg6 uqkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 w23si6943845pga.454.2019.03.22.12.10.15; Fri, 22 Mar 2019 12:10:33 -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; 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 S1727567AbfCVTJ1 (ORCPT + 99 others); Fri, 22 Mar 2019 15:09:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:39192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726215AbfCVTJ0 (ORCPT ); Fri, 22 Mar 2019 15:09:26 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 8C304218FE; Fri, 22 Mar 2019 19:09:25 +0000 (UTC) Date: Fri, 22 Mar 2019 15:09:23 -0400 From: Steven Rostedt To: LKML Cc: Masami Hiramatsu , Shuah Khan , Ingo Molnar , Andrew Morton Subject: [PATCH] selftests/ftrace: Select an existing function in kprobe_eventname test Message-ID: <20190322150923.1b58eca5@gandalf.local.home> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Rostedt (VMware) Running the ftrace selftests on the latest kernel caused the kprobe_eventname test to fail. It was due to the test that searches for a function with at "dot" in the name and adding a probe to that. Unfortunately, for this test, it picked: optimize_nops.isra.2.cold.4 Which happens to be marked as "__init", which means it no longer exists in the kernel! (kallsyms keeps those function names around for tracing purposes) As only functions that still exist are in the available_filter_functions file, as they are removed when the functions are freed at boot or module exit, have the test search for a function with ".isra." in the name as well as being in the available_filter_functions (if the file exists). Signed-off-by: Steven Rostedt (VMware) --- diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc index 3fb70e01b1fe..3ff236719b6e 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc @@ -24,7 +24,21 @@ test -d events/kprobes2/event2 || exit_failure :;: "Add an event on dot function without name" ;: -FUNC=`grep -m 10 " [tT] .*\.isra\..*$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "` +find_dot_func() { + if [ ! -f available_filter_functions ]; then + grep -m 10 " [tT] .*\.isra\..*$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " " + return; + fi + + grep " [tT] .*\.isra\..*" /proc/kallsyms | cut -f 3 -d " " | while read f; do + if grep -s $f available_filter_functions; then + echo $f + break + fi + done +} + +FUNC=`find_dot_func | tail -n 1` [ "x" != "x$FUNC" ] || exit_unresolved echo "p $FUNC" > kprobe_events EVENT=`grep $FUNC kprobe_events | cut -f 1 -d " " | cut -f 2 -d:`